O'Reilly logo

Hands-On Networking with Azure by Mohamed Waly

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Attaching an NIC to an Azure VM using Azure CLI 2.0

First, you need to put the VM into a Stopped (Deallocated) state. You can do this by running the following command:

az vm deallocate --resource-group PacktPub --name PacktPubVMCLI

Next, you need to create an NIC by running the following command:

az network nic create --resource-group PacktPub --name AddNICCLI--vnet-name CLIVNet --subnet S1 --network-security-group CLINSG

After that, you can add the NIC to the VM by running the following command:

az vm nic add --resource-group PacktPub --vm-name PacktPubVMCLI --nics ADDNICCLI

Finally, you can start the VM by running the following command:

az vm start --resource-group PacktPub --name PacktPubVMCLI

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required