Reputation: 529
How can I programmatically detach a NIC from its VM in Azure ARM ?
Can someone please help with the URL that I need to post in order to do that ?
Upvotes: 3
Views: 4086
Reputation: 52
There is one to one relationship between VM to NIC. There is no much benefit we will get for detach of NIC, So AzureRM provided the REST API to delete the NIC.
Below mentioned is the REST API Call for delete NIC :
https://msdn.microsoft.com/en-us/library/azure/mt163562.aspx
Upvotes: 0
Reputation: 6547
If you use the Azure Resource Manager Templates
from the azure-cli
or PowerShell
to deploy, then you can simply use the deployment in Incremental
mode and remove the networkProfile
of the virtual machine. It should update the virtual machine to be detached from the old NIC.
Upvotes: 0
Reputation: 514
There no API to detach, only remove the nic https://msdn.microsoft.com/en-us/library/azure/mt163562.aspx. a workaround would be to re-crate the VM (using the same disks as the original one) with the new vnet, nic,ips etc.
Upvotes: 1