Try to update OsProfile after Virtual Machine is migrated from on premise to azure cloud because I need to install provisionVMAgent under osProfile ? Using this API Version-
Reference Url for 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
}
}
]
}
}
}
Response In Postman -
{
"error": {
"code": "PropertyChangeNotAllowed",
"message": "Changing property 'osProfile' is not allowed.",
"target": "osProfile"
}
Is This Possible to update Os Profile after Vm migration ? Or Can I install provisionVMAgent in virtual machine after migration of VM ?