Monday, May 5, 2014

Making mountains out of molehills with Azure

Ok, so to get the first two listed items taken care of is quite easy to do, but hard to do correctly.  Let's take a look at them:

  1. Create a private network and affinity group
  2. Create storage account

At its simplest it is just:

  1. Create a new NetworkConfig.xml file (see below)
  2. Run the following three commands:

     New-AzureAffinityGroup -Name "MAGENIC-LAB" -Location "East US"
     Set-AzureVNetConfig -ConfigurationPath "NetworkConfig.xml"
     New-AzureStorageAccount -StorageAccountName "mageniclab" -Location "East US"

Which works great unless you have a name collision.  Next time I will add some logic to handle name collisions and set up some conventions around the names.

Network Config.xml
<networkconfiguration xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/ServiceHosting/2011/07/NetworkConfiguration">
  <virtualnetworkconfiguration>
    <dns>
    <virtualnetworksites>
      <virtualnetworksite affinitygroup="MAGENIC-LAB" name="MAGENIC-LAB">
        <addressspace>
          <addressprefix>10.0.0.0/8</addressprefix>
        </addressspace>
        <subnets>
          <subnet name="Subnet-1">
            <addressprefix>10.0.0.0/11</addressprefix>
          </subnet>
        </subnets>
      </virtualnetworksite>
    </virtualnetworksites>
  </dns>
 </virtualnetworkconfiguration>
</networkconfiguration>

No comments:

Post a Comment