azure - 无法在 PowerShell Runbook 中从 Azure 存储下载模板文件

标签 azure powershell virtual-machine azure-storage runbook

我想在 powershell Runbook 中自动部署数据科学 VM。为此,我使用 New-AzResourceGroupDeployment 命令并在 -ParameterUri-TemplateParameterUri 中指定参数文件。不幸的是,powershell 无法下载这些文件来使用它们。错误消息是:

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.

我的脚本的一部分:(还提供了 Deployment 和 ResourceGroupName)

$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

我只是想我必须提供诸如存储帐户上下文之类的东西或其他东西来授权 powershell 访问文件,不是吗?也许有一些更简单的方法可以实现我的目标?

提前致谢!

最佳答案

正如 Mantri 所说,您应该将 blob 容器设置为公共(public),或提供共享访问签名 URL。

方法1.将blob容器更改为public:nav进入容器,然后点击“更改访问级别”->选择“Container(anonymous read xxxxx)”

enter image description here

方法 2.为 blob 提供共享访问签名 URL:

enter image description here

enter image description here

关于azure - 无法在 PowerShell Runbook 中从 Azure 存储下载模板文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55122090/

相关文章:

security - 为什么我要为 sudo 要求一个 tty?要求它的安全好处是什么?

ubuntu - vagrant 无法连接到虚拟框

android - 使用 Azure Windows 10 运行 Android 模拟器

java - Azure IOT 中心上的 MQTT : Error initializing MQTT connection:Not authorized to connect

Azure Web 角色在运行数周后自行回收?

windows - 如何在启动 powershell.exe 之前设置首选项 `$ErrorView = "CategoryView"`

git - 无法重播git bisect: “error: couldn' t获得rev的oid”

powershell - 在 Powershell 中使用变量 Get-ADUser -Filter

azure - 如何安全地将凭据放入自定义 Azure DevOps 任务中?

azure - 如何在 Kusto 中将十六进制字符串转换为 Ascii 字符串