尝试在虚拟机从本地迁移到天蓝色云后更新 OsProfile,因为我需要在 osProfile 下安装 provisionVMAgent?使用此 API 版本-
APi 的参考网址 - https://docs.microsoft.com/en-us/rest/api/compute/virtualmachines/createorupdate#request-body
PUT https://management.azure.com/subscriptions/ {subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}?api-version=2019-03-01
{
"location": "westus",
"properties": {
"hardwareProfile": {
"vmSize": "Standard_D1_v2"
},
"storageProfile": {
"osDisk": {
"name": "myVMosdisk",
"image": {
"uri": "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/{existing-generalized-os-image-blob-name}.vhd"
},
"osType": "Windows",
"createOption": "FromImage",
"caching": "ReadWrite",
"vhd": {
"uri": "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk.vhd"
}
}
},
"osProfile": {
"adminUsername": "{your-username}",
"computerName": "myVM",
"adminPassword": "{your-password}"
},
"networkProfile": {
"networkInterfaces": [
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}",
"properties": {
"primary": true
}
}
]
}
}
}
邮递员的回应 -
{
"error": {
"code": "PropertyChangeNotAllowed",
"message": "Changing property 'osProfile' is not allowed.",
"target": "osProfile"
}
这可以在 Vm 迁移后更新 Os Profile 吗?或者我可以在虚拟机迁移后在虚拟机中安装 provisionVMAgent 吗?