Rename virtual network on Azure

Is there a way to rename an existing virtual network on Azure? Via powershell, for instance.

I see no options in the portal UI, and I've already setup a sizeable deployment within the existing network.


Solution 1:

Aug 2015. It is still not possible to rename a VNET. The solution is still to create a new VNET and migrate the resources into it.

Solution 2:

I'm not sure if you can really change it (haven't tried), but if, then through PowerShell and the Set-AzureVNetConfig cmdlet.

<NetworkConfiguration xmlns="http://schemas.microsoft.com/ServiceHosting/2011/07/NetworkConfiguration">
  <VirtualNetworkConfiguration>
    <Dns>
      <DnsServers>
        <DnsServer name="<server-name>" IPAddress="<server-address>"/>
      </DnsServers>
    </Dns>
    <LocalNetworkSites>
      <LocalNetworkSite name="<site-name>">
        <VPNGatewayAddress>gateway-address</VPNGatewayAddress>
        <AddressSpace>
          <AddressPrefix>address-prefix</AddressPrefix>
        </AddressSpace>
      </LocalNetworkSite>
    </LocalNetworkSites>
    <VirtualNetworkSites>
      <VirtualNetworkSite name="<site-name>" AffinityGroup="<group-name>">
        <Gateway profile="Small">
          <VPNClientAddressPool>
            <AddressPrefix>address-prefix</AddressPrefix>
          </VPNClientAddressPool>
          <ConnectionsToLocalNetwork>
            <LocalNetworkSiteRef name="<site-name>"/>
              <Connection type="Dedicated"/>
            </LocalNetworkSiteRef>
          </ConnectionsToLocalNetwork>
        </Gateway>
        <DnsServersRef>
          <DnsServerRef name="<server-name>"/>
        </DnsServersRef>
        <Subnets>
          <Subnet name="<subnet-name>">
            <AddressPrefix>address-prefix</AddressPrefix>
          </Subnet>
        </Subnets>
        <AddressSpace>
          <AddressPrefix>address-prefix</AddressPrefix>
        </AddressSpace>
      </VirtualNetworkSite>
    </VirtualNetworkSites>
  </VirtualNetworkConfiguration>
</NetworkConfiguration>

E.g. retrieve the config:

Get-AzureVNetConfig -ExportToFile "C:\temp\azurenetconfig.netcfg"

modify the file

Upload config:

Set-AzureVNetConfig -ConfigurationPath "C:\temp\azurenetconfig.netcfg"

See

Set-AzureVNetConfig,
Create a Windows Azure Network using PowerShell,
Windows Azure Virtual Network Configuration