title: How to change ip address from VM with Azure-CLI
body: <p>Im having some difficult to change the public ip address dynamic from my VM using Azure-cli, I need to change the ip everytime when I restart the machine, Im using Ubuntu and shellscript.</p>
  
  <p>I've created the public ip</p>
  
  <p><code>az network public-ip create -g MyResourceGroup -n MyIp</code></p>
  
  <p>to create/update the NIC</p>
  
  <p><code>az network nic ip-config create -g MyResourceGroup -n MyIpConfig --nic-name MyNic --make-primary</code></p>
  
  <p>create the nic</p>
  
  <p><code>az network nic create -g MyResourceGroup --vnet-name MyVnet --subnet MySubnet -n MyNic</code></p>