[英]i am trying to use local power shell as cloud power shell (azure power shell vs local power shell )
[英]How to access local file path in Azure power shell Run book
團隊,我正在嘗試將文件從本地計算機上傳到 azure blob 存儲帳戶。 我可以通過在本地電源 shell 中運行腳本來上傳文件。 但是,當我在 Azure 自動化電源 shell 運行手冊中嘗試相同的腳本時,我遇到了錯誤。
Test-Path -Path 'D:\UploadFolder\Sample.txt' -- Returns True in local powershell while uploading
Test-Path -Path 'D:\UploadFolder\Sample.txt' -- Returns False in azure automation powershell runbook while uploading
錯誤:找不到驅動器“D”
我在 Runbook 中檢查了以下返回 false 的代碼。
Get-PSDrive -Name 'D' -- Return false
我的問題:
1) 我們如何訪問 Runbook 中的任何本地文件路徑?
2) 我們在 azure 中是否有任何刀片可以在自動化帳戶本身中存儲/創建文件? (這個問題的目的是“我想在 azure 自動化中手動創建文件/明智地在其中寫入一些內容,然后在 Azure blob 存儲中上傳相同的文件。)
提前致謝
您無法通過 Azure 自動化訪問本地系統文件。 如果你有像鍵值這樣的小信息,你存儲在 Azure 自動化變量部分
//獲取自動化PowerShell腳本中的變量值
$cosmosDbAccountName = Get-AutomationVariable -Name 'CosmosDbAccountName'
$databaseName = Get-AutomationVariable -Name 'DatabaseName'
選項1
您可以在 blob 中上傳文件並從 Azure 自動化腳本中讀取 blob。
選項 2
您可以使用 WebJob(應用服務)運行 PowerShell 腳本,並且可以在 WebJob 中上傳腳本和文件。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.