title: Azure: Error while using Azure virtual network, It says subnet is not valid in virtual network
body: <pre><code>$rg1=&quot;firstyear-rg-01&quot;
  $loc=&quot;eastasia&quot;
  
  New-AzResourceGroup -name $rg1 -location $loc
  $ec1 = New-AzVirtualNetworkSubnetConfig -Name &quot;ec-lab-sn-01&quot; -AddressPrefix &quot;10.0.0.0/27&quot;
  $cs1 = New-AzVirtualNetworkSubnetConfig -Name &quot;cs-lab-sn-01&quot;  -AddressPrefix &quot;10.0.1.0/27&quot;
  $it1 = New-AzVirtualNetworkSubnetConfig -Name &quot;it-lab-sn-01&quot; -AddressPrefix &quot;10.0.2.0/27&quot;
  $mc1 = New-AzVirtualNetworkSubnetConfig -Name &quot;mech-lab-sn-01&quot;  -AddressPrefix &quot;10.0.3.0/27&quot;
  $vn1 = New-AzVirtualNetwork -Name &quot;firstyear-vn-01&quot; -ResourceGroupName $rg1 -Location $loc -AddressPrefix &quot;10.0.0.0/25&quot; -Subnet $ec1,$cs1,$it1,$mc1
  </code></pre>
  <p>The above is the exact code I tried, but it gives error:</p>
  <blockquote>
  <p>New-AzVirtualNetwork: Subnet 'cs-lab-sn-01' is not valid in virtual
  network 'firstyear-vn-01'. StatusCode: 400 ReasonPhrase: Bad Request
  ErrorCode: NetcfgInvalidSubnet ErrorMessage: Subnet 'cs-lab-sn-01' is
  not valid in virtual network 'firstyear-vn-01'. OperationID :
  c5bd59de-a637-45ec-99a7-358372184e98</p>
  </blockquote>
  <p>What am I doing wrong?</p>