title: Create an Azure VM with an unmanaged disk
body: <p>I'm trying to <strong>create an Azure VM with an unmanaged disk via PowerShell</strong> since managed disks aren't supported in Azure Government yet.</p>
  
  <p>None of the <a href="https://docs.microsoft.com/azure/virtual-machines/windows/quick-create-powershell" rel="nofollow noreferrer">documentation</a> I could find for PowerShell VM creation references managed or unmanaged disks and the default seems to be managed disks. My VM creation fails with the following error:</p>
  
  <blockquote>
    <p>New-AzureRmVM : Managed Disks are not supported in this region. </p>
    
    <p>ErrorCode: BadRequest</p>
  </blockquote>
  
  <p>Here's the script I'm using:</p>
  
  
  
  <pre><code>$location = "USGovTexas"
  
  New-AzureRmResourceGroup -Name myResourceGroup -Location $location
  
  # Create a subnet configuration
  $subnetConfig = New-AzureRmVirtualNetworkSubnetConfig -Name mySubnet -AddressPrefix 192.168.1.0/24
  
  # Create a virtual network
  $vnet = New-AzureRmVirtualNetwork -ResourceGroupName myResourceGroup -Location $location `
      -Name MYvNET -AddressPrefix 192.168.0.0/16 -Subnet $subnetConfig
  
  # Create a public IP address and specify a DNS name
  $pip = New-AzureRmPublicIpAddress -ResourceGroupName myResourceGroup -Location $location `
      -AllocationMethod Static -IdleTimeoutInMinutes 4 -Name "mypublicdns$(Get-Random)"
  
  # Create an inbound network security group rule for port 3389
  $nsgRuleRDP = New-AzureRmNetworkSecurityRuleConfig -Name myNetworkSecurityGroupRuleRDP  -Protocol Tcp `
      -Direction Inbound -Priority 1000 -SourceAddressPrefix * -SourcePortRange * -DestinationAddressPrefix * `
      -DestinationPortRange 3389 -Access Allow
  
  # Create an inbound network security group rule for port 80
  $nsgRuleWeb = New-AzureRmNetworkSecurityRuleConfig -Name myNetworkSecurityGroupRuleWWW  -Protocol Tcp `
      -Direction Inbound -Priority 1001 -SourceAddressPrefix * -SourcePortRange * -DestinationAddressPrefix * `
      -DestinationPortRange 80 -Access Allow
  
  # Create a network security group
  $nsg = New-AzureRmNetworkSecurityGroup -ResourceGroupName myResourceGroup -Location $location `
      -Name myNetworkSecurityGroup -SecurityRules $nsgRuleRDP,$nsgRuleWeb
  
  # Create a virtual network card and associate with public IP address and NSG
  $nic = New-AzureRmNetworkInterface -Name myNic -ResourceGroupName myResourceGroup -Location $location `
      -SubnetId $vnet.Subnets[0].Id -PublicIpAddressId $pip.Id -NetworkSecurityGroupId $nsg.Id
  
  # Define a credential object
  $cred = Get-Credential
  
  # Create a virtual machine configuration
  $vmConfig = New-AzureRmVMConfig -VMName myVM -VMSize Standard_DS2_v2 | `
      Set-AzureRmVMOperatingSystem -Windows -ComputerName myVM -Credential $cred | `
      Set-AzureRmVMSourceImage -PublisherName MicrosoftWindowsServer -Offer WindowsServer `
      -Skus 2016-Datacenter -Version latest | Add-AzureRmVMNetworkInterface -Id $nic.Id
  
  # Create the virtual machine
  New-AzureRmVM -ResourceGroupName myResourceGroup -Location $location -VM $vmConfig
  </code></pre>