简体   繁体   中英

Cannot download template file from Azure Storage in PowerShell Runbook

I want to deploy a Data Science VM automatically in a powershell runbook. To do so, I use the New-AzResourceGroupDeployment command and specify the parameter files in the -ParameterUri and -TemplateParameterUri . Unfortunately, powershell cannot download these files to use them. The Error Message is:

New-AzResourceGroupDeployment : 12:25:28 PM - Error: Code=InvalidContentLink; Message=Unable to download deployment content from ' https://[SAName].blob.core.windows.net/automation/WindowsVirtualMachine.json '. The tracking Id is '56714bef-f653-42bb-80e2-8d0842e2d94e'. Please see https://aka.ms/arm-deploy for usage details.

Part of my script: (The Deployment and ResourceGroupName are provided as well)

$TemplateUri = "https://[SAName].blob.core.windows.net/automation/WindowsVirtualMachine.json"
$TemplateParameterUri = "https://[SAName].blob.core.windows.net/automation/WindowsVirtualMachine.parameters.json"
New-AzResourceGroupDeployment -Name $ResourceGroupDeploymentName `
    -ResourceGroupName $ResourceGroupName `
    -TemplateUri $TemplateUri `
    -TemplateParameterUri $TemplateParameterUri `
    -Force

I just thougt that I have to give something like the Storage Account Context or something else to authorize powershell to access the files, isn't it? Perhaps there is some easier ways to reach my goal?

Thanks in Advance!

As per Mantri said, you should set the blob container to public, or provide a Shared Access Signature URL.

Method 1.Change the blob container to public: nav into the container, then click "Change access level" -> select "Container(anonymous read xxxxx)"

在此处输入图片说明

Method 2.Provide a Shared Access Signature URL for the blob:

在此处输入图片说明

在此处输入图片说明

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