Mou*_*lil 4 powershell azure azure-storage azure-powershell
在powershell中,我通过调用上下文来验证它是否存在.
New-AzureStorageContext -StorageAccountName "testdisks401" -StorageAccountKey "...."
Run Code Online (Sandbox Code Playgroud)
结果
StorageAccountName : testdisks401
BlobEndPoint : https://testdisks401.blob.core.windows.net/
TableEndPoint : https://testdisks401.table.core.windows.net/
QueueEndPoint : https://testdisks401.queue.core.windows.net/
FileEndPoint : https://testdisks401.file.core.windows.net/
Context : Microsoft.WindowsAzure.Commands.Common.Storage.AzureStorageContext
Name :
StorageAccount : BlobEndpoint=https://testdisks401.blob.core.windows.net/;QueueEndpoint=https://testdisks401.queue.core.windows.net/;TableEndpoint=https://testdi
sks401.table.core.windows.net/;FileEndpoint=https://testdisks401.file.core.windows.net/;AccountName=testdisks401;AccountKey=[key hidden]
EndPointSuffix : core.windows.net/
Run Code Online (Sandbox Code Playgroud)
当我尝试在这里设置它时:
Set-AzureSubscription -SubscriptionName 'XXXX' -CurrentStorageAccount "testdisks401"
Run Code Online (Sandbox Code Playgroud)
我明白了
Set-AzureSubscription : ResourceNotFound: The storage account 'testdisks401' was not found.
At line:1 char:1
+ Set-AzureSubscription -SubscriptionName 'XXX
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Set-AzureSubscription], CloudException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.Profile.SetAzureSubscriptionCommand
Run Code Online (Sandbox Code Playgroud)
被困了好一阵子.我基本上想编写一个shellcript来从现有的操作系统光盘创建一个VM.我设法使用powershell创建现有光盘的副本(使用第一个命令的上下文使其工作).但现在我正在尝试使用以下方法创建VM配置:
$vmI1 = New-AzureVMConfig -Name "TestRecover" -InstanceSize Small -AvailabilitySetName 'RDGW' -DiskName 'MY-OS-Disk-Name'
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
New-AzureVMConfig : Must specify MediaLocation or set a current storage account using Set-AzureSubscription.
At line:1 char:9
+ $vmI1 = New-AzureVMConfig -Name "TestRecover" -InstanceSize Small -Av ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-AzureVMConfig], ArgumentException
+ FullyQualifiedErrorId : System.ArgumentException,Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.NewAzureVMConfigCommand
Run Code Online (Sandbox Code Playgroud)
已经为此提供了一个解决方案,它将我带到了这里(坚持丢失存储帐户错误).
Set-AzureSubscriptionCmdlet期望通过-CurrentStorageAccount参数指定的存储帐户是经典存储帐户.
请确保您指定的是经典存储帐户的名称,而不是资源管理器存储帐户的名称.
| 归档时间: |
|
| 查看次数: |
2920 次 |
| 最近记录: |