Azure VM - 自定义脚本扩展问题 - 无法解析远程名称 [英] Azure VM - Custom Script Extension Issue - Remote name could not be resolved

查看:63
本文介绍了Azure VM - 自定义脚本扩展问题 - 无法解析远程名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个无法在Windows VM上运行自定义脚本的问题。无论访问如何,它总是会给我相同的问题/错误。我尝试过使用ARM模板,Powershell和门户网站
,结果相同。


 


我收到的错误:


无法下载所有指定的文件。退出。错误消息:无法解析远程名称:'storageaccount.blob.core.windows.net


 


现在我不明白这一点,因为我运行自定义脚本扩展一个Linux VM,它可以很好地引用完全相同的存储帐户和容器。我还运行我用来在服务器上自己执行
的命令作为测试,如果它在我有脚本的目录中它可以工作,所以它应该工作。


 


如果我可能遗漏了一些简单的东西,请问是否有人有同样的问题或任何建议?我现在处于停顿状态,并且在github上比较了我的其他
,看起来应该可行。我也引用了这个并且看起来还不错。

https://docs.microsoft.com/en-us/azure/virtual-machines/extensions/custom-script-windows


 


使用的ARM模板代码


 


  {


<跨度>&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
" apiVersion":" 2018-06-01",


<跨度>&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
" type" ;:\"Microsoft.Compute / virtualMachines / extensions",


<跨度>&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
" name":" [concat(parameters('dnsLabelPrefix'),'/ CustomScriptExtension')]",


     
" location":"[resourceGroup()。location]",


<跨度>&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
" dependsOn":[


  &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
" [resourceId('Microsoft.Compute / virtualMachines',parameters('dnsLabelPrefix'))]"


     
],


    &NBSP;&NBSP;
" properties" ;: {


  &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
" publisher":" Microsoft.Compute",


<跨度>&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
" type" ;:"CustomScriptExtension",


<跨度>&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
" typeHandlerVersion":" 1.9",


<跨度>&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
" autoUpgradeMinorVersion":true,


  ;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
" settings" ;: {


  &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
" fileUris":[


  &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
" https://storageaccount.blob.core.windows.net/ artifacts / CreateUser.ps1 "


     ;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
],


    &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
" timestamp":123456789


  &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
},


    &NBSP;&NBSP;&NBSP;&NBSP;
" protectedSettings":{


  &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
" commandToExecute":" powershell -ExecutionPolicy Unrestricted -File CreateUser.ps1",


<跨度>&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
" storageAccountName":" storageaccount",


<跨度>&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
" storageAccountKey":" storagekey"


&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
}


      ;&NBSP;
}


   
}


 


使用Powershell命令


 


$ fileUri = @(" https:/ /storageaccount.blob.core.windows.net/artifacts/CreateUser.ps1")


  ;


$ Settings = @ {" fileUris" = $ fileUri};


 


$ storageaccname =" storageaccount"


$ storagekey =" storagekey"


$ ProtectedSettings = @ { " storageAccountName" = $ storageaccname; " storageAccountKey" = $ storagekey; " commandToExecute" =" powershell -ExecutionPolicy Unrestricted
-File CreateUser.ps1"};


 


 


  Set-AzureRmVMCustomScriptExtension -ResourceGroupName" resource group" - 位置"加拿大中部" `


  -VMName" vmname" -Name" CustomScript" -TypeHandlerVersion" 1.1" -StorageAccountName" storageaccount" `


  -StorageAccountKey" storagekey" -FileName" CreateUser.ps1" -ContainerName" artifacts"


 


如果有任何想法任何帮助总是受到赞赏

解决方案

您是否可以登录虚拟机并查看我们是否有更多有关失败原因的详细信息? 


https://docs.microsoft.com/en-us/azure/virtual-machines/extensions / custom-script-windows#troubleshoot-and-support


日志位于VM内部 


C:\ WindowsAzure\Logs\Plugins\Microsoft.Compute.CustomScriptExtension


I have an issue where I can't get a custom script going on a Windows VM. It will always give me the same issue/error regardless of access. I've tried with ARM Template, Powershell and through portal with all same results.

 

Error I receive:

Failed to download all specified files. Exiting. Error Message: The remote name could not be resolved: 'storageaccount.blob.core.windows.net

 

Now I don't understand this as I run a custom script extension on a linux VM and it works just fine referencing the exact same storage account and container. I also run the command I use to execute on it's own on the server as a test and it works if it's in the directory I have the script, so it should work.

 

Asking to see if anyone has had the same issue or not or any suggestions if I am maybe missing something simple? I'm at a standstill on what to try next at this point and have compared mine to others on github and looks like it should work. I also reference this and looks OK as well https://docs.microsoft.com/en-us/azure/virtual-machines/extensions/custom-script-windows

 

ARM Template Code used

 

 {

      "apiVersion": "2018-06-01",

      "type": "Microsoft.Compute/virtualMachines/extensions",

      "name": "[concat(parameters('dnsLabelPrefix'),'/CustomScriptExtension')]",

      "location": "[resourceGroup().location]",

      "dependsOn": [

        "[resourceId('Microsoft.Compute/virtualMachines', parameters('dnsLabelPrefix'))]"

      ],

      "properties": {

        "publisher": "Microsoft.Compute",

        "type": "CustomScriptExtension",

        "typeHandlerVersion": "1.9",

        "autoUpgradeMinorVersion": true,

        "settings": {

          "fileUris": [

            "https://storageaccount.blob.core.windows.net/artifacts/CreateUser.ps1"

          ],

          "timestamp": 123456789

        },

        "protectedSettings": {

          "commandToExecute": "powershell -ExecutionPolicy Unrestricted -File CreateUser.ps1",

          "storageAccountName": "storageaccount",

          "storageAccountKey": "storagekey"

        }

      }

    }

 

Powershell Command used

 

$fileUri = @("https://storageaccount.blob.core.windows.net/artifacts/CreateUser.ps1")

 

$Settings = @{"fileUris" = $fileUri};

 

$storageaccname = "storageaccount"

$storagekey = "storagekey"

$ProtectedSettings = @{"storageAccountName" = $storageaccname; "storageAccountKey" = $storagekey; "commandToExecute" = "powershell -ExecutionPolicy Unrestricted -File CreateUser.ps1"};

 

 

 Set-AzureRmVMCustomScriptExtension -ResourceGroupName "resource group" -Location "Canada Central" `

 -VMName "vmname" -Name "CustomScript" -TypeHandlerVersion "1.1" -StorageAccountName "storageaccount" `

 -StorageAccountKey "storagekey" -FileName "CreateUser.ps1" -ContainerName "artifacts"

 

If anyone has any ideas any help is always appreciated

解决方案

Can you login to the VM and check to see if we have any more details on why it is failing? 

https://docs.microsoft.com/en-us/azure/virtual-machines/extensions/custom-script-windows#troubleshoot-and-support

Logs are located inside the VM at 

C:\WindowsAzure\Logs\Plugins\Microsoft.Compute.CustomScriptExtension


这篇关于Azure VM - 自定义脚本扩展问题 - 无法解析远程名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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