title: Create VM and associate the VM to existing virtual network
body: <p>I created virtual network and I want to deploy a new VM to this virtual network. The network</p>
  
  <p>I tried to create the VM using this command:</p>
  
  <pre><code>az vm create --resource-group myGroup --name VMTestNet1 --location eastus --image eastus1Image --vnet-name eastusVNet1 --admin-username azureuser --size Standard_F4S --public-ip-address ""
  </code></pre>
  
  <p>I got this exception:</p>
  
  <pre><code>Deployment failed. {
    "error": {
      "code": "InUseSubnetCannotBeDeleted",
      "message": "Subnet GatewaySubnet is in use by /subscriptions/subscriptionId/resourceGroups/Automationsystem/providers/Microsoft.Network/virtualNetworkGateways/eastusGW/ipConfigurations/vnetGatewayConfig0 and cannot be deleted.",
      "details": []
    }
  }
  </code></pre>
  
  <p>How can I deploy my VM to an existing Virtual network?</p>