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
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset