【发布时间】:2018-07-23 23:34:38
【问题描述】:
我正在使用 PowerShell ISE。当我运行Add-AzureDisk
我得到一个 CLI 向导并填写 DiskName
我的剪贴板中有 vhd 文件 uri(从门户网站复制)
当我使用没有 "..." 的 uri 时,我得到:
Add-AzureDisk : 无效的 URI: 无法解析主机名。
在 line:1 char:1
- 添加-AzureDisk
- ~~~~~~~~~~~~~
- CategoryInfo : NotSpecified: (:) [Add-AzureDisk], UriFormatException
- FullyQualifiedErrorId:System.UriFormatException,Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.AddAzureDisk 命令
当我使用 "uri here" 时,我得到:
Add-AzureDisk : 无效的 URI:URI 方案无效。在 line:1 char:1
我使用了这个按钮:
我开始认为我的 powershell 模块已经过时了,所以我将Get-Module AzureRm.Profile -ListAvailable 运行为suggested here:
目录:C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ResourceManager\AzureResourceManager
ModuleType 版本名称 ExportedCommands
---------- -------- ---- ----
清单 4.0.0 AzureRM.Profile {Disable-AzureRmDataCollection, Disable-AzureRmContextAutosave,...
但我也有 v5(在 the docs website 上找到):
Get-Module -ListAvailable -Name AzureRm.Resources |选择版本
版本
5.0.0
您可能已经猜到了,我更习惯于门户网站。但是我正在尝试使用两个 un托管磁盘 vhd 创建一个新的虚拟机,这些磁盘位于我的 blob 存储容器中。
编辑我尝试了 Azure CLI:
az vm create -n "tmp-vm" -g "resource-tmp" --attach-os-disk "https://the-uri-copied-from-ui.blob.core.windows.net/vhd-container/vm-osdisk.vhd" --size Standard_DS1_v2 --use-unmanaged-disk --os-type windows
得到:
At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-debug for usage details.
{
"status": "Failed",
"error": {
"code": "ResourceDeploymentFailure",
"message": "The resource operation completed with terminal provisioning state 'Failed'.",
"details": [
{
"code": "DiskBlobPendingCopyOperation",
"message": "Disk blob https://the-uri-copied-from-ui.blob.core.windows.net/vhd-container/vm-osdisk.vhd is not ready. Copy state: Failed. Please retry when the blob is ready."
}
]
}
} Correlation ID: 0e1231a9-aa0e-4d79-8953-92ea43c658eb
我使用在此处找到的 powershell 命令创建了 vhd: https://stackoverflow.com/a/45569760/169714 也许失败了?我没有收到错误或任何东西?我该如何巩固它?
edit2 我尝试了templates 并且很难获得调试信息。但我现在发现了错误。和以前一样:
blob 似乎具有预期的大小。租赁状态说可用。上次修改日期是一秒前,这是否意味着底层存储仍在进行中?我试图运行Get-AzureStorageBlobCopyState -Blob tmpvmosdisk.vhd -Container vhd-containers -WaitForComplete,但这给出了一个关于非必需(我不知道)参数的错误:
Get-AzureStorageBlobCopyState : Could not get the storage context. Please pass in a storage context or set the current storage context.
edit 3 数据磁盘似乎再次刷新。原来是 512GB,现在又归零了?
所以当我想将 vhd 添加为磁盘时,我再次收到未准备好的消息...
【问题讨论】:
-
如果要将数据磁盘添加到 Azure VM,请使用:Add-AzureDataDisk 参考:docs.microsoft.com/en-us/powershell/module/azure/…
-
它不仅仅是一个数据盘。它是主要的操作系统磁盘,因为我不想要托管磁盘,而是更便宜的非托管磁盘。所以我将一个快照(我认为/希望)存储在一个 blob 容器中,并想用它创建一个虚拟机。
标签: powershell azure