Azure VM自定义脚本扩展SAS令牌支持 [英] Azure VM custom script extension SAS token support

查看:121
本文介绍了Azure VM自定义脚本扩展SAS令牌支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用ARM模板向Azure VM部署添加自定义脚本扩展,并且希望它使用SAS令牌从存储帐户下载文件.

I am trying to deploy add a custom script extension to an Azure VM using an ARM template, and I want to have it download files from a storage account using a SAS token.

这是模板(简体):

{
    "name": "CustomScriptExtension"
    "type": "Microsoft.Compute/virtualMachines/extensions",
    "location": "eastus",
    "properties": {
        "publisher": "Microsoft.Compute",
        "type": "CustomScriptExtension",
        "typeHandlerVersion": "1.8",
        "settings": {
            "fileUris": [
                "https://{storage-account}.blob.core.windows.net/installers/{installer}.msi?sv=2015-04-05&sig={signature}&st=2017-05-03T05:18:28Z&se=2017-05-10T05:18:28Z&srt=o&ss=b&sp=r"
            ],
            "commandToExecute": "start /wait msiexec /package {installer}.msi /quiet"
        },
    }
}

部署它会导致此错误:

{
  "name": "CustomScriptExtension",
  "type": "Microsoft.Compute.CustomScriptExtension",
  "typeHandlerVersion": "1.8",
  "statuses": [
    {
      "code": "ProvisioningState/failed/3",
      "level": "Error",
      "displayStatus": "Provisioning failed",
      "message": "Failed to download all specified files. Exiting. Error Message: Missing mandatory parameters for valid Shared Access Signature"
    }
  ]
}

如果我直接用SAS令牌访问URL,它将很好地下拉文件,因此我知道SAS令牌是正确的.自定义脚本扩展名是否不支持带有SAS令牌的URL?

If I hit the URL with the SAS token directly it pulls down the file just fine so I know the SAS token is correct. Does the custom script extension not support URLs with SAS tokens?

推荐答案

我知道了,这必须是自定义脚本扩展中的错误,导致其不支持存储帐户级SAS令牌.如果我在SAS令牌(不属于存储帐户级别SAS令牌规范的一部分)的末尾添加&sr=b,它将开始工作.

I figured it out, this must be a bug in the custom script extension which causes it to not support storage account level SAS tokens. If I add &sr=b on the the end of the SAS token (which isn't part of the storage account level SAS token spec) it starts working.

我在这里找到此信息: https://azureoperations.wordpress.com/2016/11/21/first-blog-post/

I found this info here: https://azureoperations.wordpress.com/2016/11/21/first-blog-post/

这篇关于Azure VM自定义脚本扩展SAS令牌支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆