我已经在Azure中成功创建了VM,并使用以下内容导出其设置,然后删除了VM和服务:
export-azurevm -servicename "testautomation" -name "testautomation" -path "C:\azurestates\testautomation.xml" remove-azurevm -servicename "testautomation" -name "testautomation"
但是,当我尝试重新创建VM时,得到以下信息:
PS C:> import-azurevm -path "C:\azurestates\testautomation.xml" | new-azurevm -servicename 'testautomation' -location "east us" new-azurevm : The remote server returned an unexpected response: (400) Bad Request.At line:1 char:60+ import-azurevm -path "C:\azurestates\testautomation.xml" | new-azurevm -servicen ...+ ~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : CloseError: (:) [New-AzureVM], ProtocolException + FullyQualifiedErrorId : Microsoft.WindowsAzure.Management.ServiceManagement.IaaS.PersistentVMs.NewAzureVMCommand
似乎应该真的很简单,但我不确定我要去哪里。在使用New-AzureVMConfig时,谷歌搜索此错误已使我指出了几处更改,但是由于不确定,我不确定如何继续。任何帮助将不胜感激。

最佳答案

您可以通过查看内部异常来获得有关发生问题的更多详细信息:

PS C:\> $sr = new-object System.IO.StreamReader($Error[0].Exception.InnerException.Response.GetResponseStream())
PS C:\> $txt = $sr.ReadToEnd()
PS C:\> $txt
PS C:\> $sr.Close()

第三个命令应打印出有关New-AzureVM调用出了什么问题的更详细的错误消息。

关于azure - (400)使用New-AzureVM Commandlet时的错误请求,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/17887413/

10-12 21:14