Azure托管磁盘,如何创建快照
我有一个应用程序,它使用存储帐户和磁盘部署VM,我想将其转换为使用托管磁盘,因为这是Azure存储的未来。我正在查看REST API—我遗漏了两件事: 1.如何从现有的托管磁盘创建快照?有一个API可以创建快照,但它是空的或来自旧的非托管磁盘 2.我可以选择创建磁盘的lun吗Azure托管磁盘,如何创建快照,azure,azure-storage,Azure,Azure Storage,我有一个应用程序,它使用存储帐户和磁盘部署VM,我想将其转换为使用托管磁盘,因为这是Azure存储的未来。我正在查看REST API—我遗漏了两件事: 1.如何从现有的托管磁盘创建快照?有一个API可以创建快照,但它是空的或来自旧的非托管磁盘 2.我可以选择创建磁盘的lun吗 如何从现有的托管磁盘创建快照?有一个API可以创建快照,但它是空的或来自旧的非托管磁盘 根据您的描述,我创建了一个测试演示来创建现有托管磁盘(OS磁盘)的快照,它运行良好。 我创建一个Windows虚拟机并使用托管磁盘作为
Url: https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{snapshotName}?api-version={api-version}
Method: PUT
Parameter:
subscriptionId The identifier of your subscription where the snapshot is being created.
resourceGroup The name of the resource group that will contain the snapshot.
snapshotName The name of the snapshot that is being created. The name can’t be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
api-version The version of the API to use. The current version is 2016-04-30-preview.
Request content:
{
"properties": {
"creationData": {
"createOption": "Copy",
"sourceUri": "/subscriptions/{subscriptionId}/resourceGroups/{YourResourceGroup}/providers/Microsoft.Compute/disks/{YourManagedDiskName}"
}
},
"location": "eastasia"
}
更多详细信息,请参考以下C#代码:
json.txt:
{
"properties": {
"creationData": {
"createOption": "Copy",
"sourceUri": "/subscriptions/xxxxxxxxxxxxxxxxxxxxxxxx/resourceGroups/BrandoSecondTest/providers/Microsoft.Compute/disks/BrandoTestVM"
}
},
"location": "eastasia"
}
代码:
结果:
Url: https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{snapshotName}?api-version={api-version}
Method: PUT
Parameter:
subscriptionId The identifier of your subscription where the snapshot is being created.
resourceGroup The name of the resource group that will contain the snapshot.
snapshotName The name of the snapshot that is being created. The name can’t be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
api-version The version of the API to use. The current version is 2016-04-30-preview.
Request content:
{
"properties": {
"creationData": {
"createOption": "Copy",
"sourceUri": "/subscriptions/{subscriptionId}/resourceGroups/{YourResourceGroup}/providers/Microsoft.Compute/disks/{YourManagedDiskName}"
}
},
"location": "eastasia"
}
更多详细信息,请参考以下C#代码:
json.txt:
{
"properties": {
"creationData": {
"createOption": "Copy",
"sourceUri": "/subscriptions/xxxxxxxxxxxxxxxxxxxxxxxx/resourceGroups/BrandoSecondTest/providers/Microsoft.Compute/disks/BrandoTestVM"
}
},
"location": "eastasia"
}
代码:
结果:
- 上述命令将在RG中创建一个受管磁盘
- 从RG下的列表中选择创建的磁盘,然后单击CreateVM
- 输入名称,选择RG,选择大小。。。。然后单击create
- 确保NSG具有所有可用的内置端口 Http-80,ssh-22
- 创建vm后,从RG的资源列表中选择vm
- 向下滚动到“runcommands”,并在无法访问SSH和HTTP的情况下运行以下命令。 sudo服务apace2重启 sudo服务ssh重启
- 这将解决从浏览器和终端访问的问题
- 如果ssh仍然不工作,请在下面的命令下运行 rm/run/nologin 现在通过ssh从终端访问vm