New-AzureRMVM:API 版本 2018-06-01 及更高版本的属性“osDisk.vhd.uri”不允许使用共享访问签名 (SAS) URINew-AzureRMVM: Shared Access Signature (SAS) URI not allowed for property 'osDisk.vhd.uri' with API version 2018-06-01 and higher

New-AzureRMVM:API 版本 2018-06-01 及更高版本的属性“osDisk.vhd.uri”不允许使用共享访问签名 (SAS) URINew-AzureRMVM: Shared Access Signature (SAS) URI not allowed for property 'osDisk.vhd.uri' with API version 2018-06-01 and higher

我在 Azure blobstore 中有一个虚拟磁盘 (vhd),想要在 Azure 中创建一个新的虚拟机。为了完成此操作,我创建了一个 powershell 脚本,其中包含以下内容:

#Global Parameters 
$ResourceGroup = Get-AzureRmResourceGroup | where {$_. ResourceGroupName -eq "VirtualMachines"}
$VMName = "vmDenodoDatabases"
$Location = "westeurope"
$netWork  =  Get-AzureRmVirtualNetwork | where {$_. Name -eq "rg-network"}

Write-Host $ResourceGroup.ResourceGroupName
#VM Parameter
$vmSize = "Standard_A2"
$BlobLocation = "https://storagedatavault.blob.core.windows.net/vms/Denodo%20Training%20QuickStart%20Virtual%20Machine-disk001.vhd?st=2019-08-24T17%3A12%3A00Z&se=2019-08-25T17%3A12%3A13Z&sp=racwdl&sv=2018-03-28&sr=c&sig=Ke1EC%2FEk%2FwUnnvhNE0grAz7YrXfoObwxzFy%2FBl7Ucdw%3D"

#Network Parameter
$SubnetName = "default"
$InterfaceName = "DenodoDBNic1"

# Create Network Security Group, Subnet and Virtual Network
$NSG = Get-AzureRmNetworkSecurityGroup
$Subnet = Get-AzureRmVirtualNetwork | where {$_.ResourceGroupName -eq "rg-Netwerk"} | Get-AzureRmVirtualNetworkSubnetConfig


# Create the Interface
#$pip = New-AzureRmPublicIpAddress -Name "$VMName-IP" -ResourceGroupName $ResourceGroup.ResourceGroupName -Location $Location -AllocationMethod Dynamic

Write-Host $Subnet.Id
#$Interface  = New-AzureRMNetworkInterface -Name $InterfaceName -ResourceGroupName $ResourceGroup.ResourceGroupName -Location $Location -SubnetId $Subnet.Id -PublicIpAddressId $pip.Id

# VM Details 
Write-Host "VM Config 1"
$VirtualMachine  = New-AzureRMVMConfig -VMName $VMName -VMSize $VMSize # -AvailabilitySetID $AvailabilitySet.Id
Write-Host "VM Config 2"
$VirtualMachine  = Add-AzureRMVMNetworkInterface -VM $VirtualMachine -Id $Interface.Id
Write-Host "VM Config 3"
$VirtualMachine  = Set-AzureRMVMOSDisk -VM $VirtualMachine -Name $VMName -VhdUri $BlobLocation -CreateOption Attach -Linux

# Create the VM in Azure
Write-Host "Create VM"
New-AzureRMVM -ResourceGroupName $ResourceGroup.ResourceGroupName -Location $Location -VM $VirtualMachine

一切顺利,除了执行的最后一部分,它返回以下输出:

New-AzureRMVM : Shared Access Signature (SAS) URI is not allowed for property 'osDisk.vhd.uri' with API version 2018-06-01 and higher.
ErrorCode: InvalidParameter
ErrorMessage: Shared Access Signature (SAS) URI is not allowed for property 'osDisk.vhd.uri' with API version 2018-06-01 and higher.
ErrorTarget: osDisk.vhd.uri
StatusCode: 400
ReasonPhrase: Bad Request
OperationID : e71a5aa2-cd0e-4282-9cba-1594e3d2bc6e
At C:\Users\Admin\Documents\PowerShell\CreateAzureVMFromBlob.ps1:37 char:1
+ New-AzureRMVM -ResourceGroupName $ResourceGroup.ResourceGroupName -Lo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [New-AzureRmVM], ComputeCloudException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Compute.NewAzureVMCommand

你能帮我么!!

曼尼感谢埃里克

答案1

微软链接,请参考该链接中提到的建议,如果您需要有关此问题的更多帮助,请告诉我们

相关内容