简体   繁体   中英

how can i make a text file on azure blob storage by using PowerShell Runbook?

I am using Azure and trying to make a text file on azure blob strage by PowerShell Runbook like this: echo "test" > test.txt

But I cannot. I think Set-AzStorageBlobContent is good to do this but I have no idea what arguments should be specified.

What arguments should be added to the following command line?

$ctx = New-AzStorageContext -StorageAccountName "test123" -UseConnectedAccount
Set-AzStorageBlobContent -Container "test_files" -Context $ctx (what should I add here?)

You first need to create a temp file since the Set-AzStorageBlobContent command wants a file.

Set-AzStorageBlobContent -Container "ContosoUpload" -File ".\\PlanningData" -Blob "Planning2015"

If you need to create temporary files as part of your runbook logic, you can use the Temp folder (that is, $env:TEMP ) in the Azure sandbox for runbooks running in Azure. The only limitation is you cannot use more than 1 GB of disk space, which is the quota for each sandbox. When working with PowerShell workflows, this scenario can cause a problem because PowerShell workflows use checkpoints and the script could be retried in a different sandbox.

https://docs.microsoft.com/en-us/azure/automation/automation-runbook-execution#temporary-storage-in-a-sandbox

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM