Welcome!

Cloud Expo Authors: Cynthia Dunlop, Elizabeth White, Trevor Parsons, Bob Gourley, Carmen Gonzalez

Blog Feed Post

Create a Windows Azure Network using PowerShell – 31 Days of Servers in the Cloud (Part 19 of 31)

Try Windows Azure FREE for 90 daysBack in Part 10 of our “31 Days of Servers in the Cloud” series, my good friend Bob Hunt wrote up an excellent step-by-step  for creating a virtual network in Windows Azure.

His article and guide was so good, in fact, that I am going to attempt to do the very same task – to create and configure a network in Windows Azure; but instead of using the Windows Azure portal, we’re going to do it entirely using PowerShell and some special Windows Azure Management Cmdlets.

“Are you out of your mind?”

Perhaps.  The goal, as it was in Bob’s article, is that in the end we have a network configured and ready to securely connect to (and extend our) existing on-premises network.  From Bob’s introduction:

Before we get started, it’s important to set the stage of what we’re trying to accomplish.  The Windows Azure Virtual Network you are about to create establishes a Site to Site (S2S) VPN between your company’s network and the Windows Azure Cloud Service using the steps outlined below, and requires that you have an already installed VPN device on your premise.  The list of currently supported VPN devices is located hereWindows Azure currently supports up to 5 S2S VPN tunnels, allowing you to have multiple Virtual Networks hosted in Windows Azure, such as a Test Network and a Production Network.

Contoso's Deployment

 

Set up PowerShell

To make this happen, of course, we’re going to have to have done a couple of things in advance:

  1. Get a Windows Azure account (start with the free 90-day trial),
  2. Get the Windows Azure PowerShell tools, and
  3. Follow some simple instructions to set up the secured connection for Windows Azure management.

Once you have this done, open up your Windows Azure PowerShell window, and open up notepad.

“Huh?  Notepad?”

Yes. 

 

The .netcfg File

For configuring networking in Windows Azure using PowerShell, there are only two Set-AzureVNet commands:

There are Get-AzureVNet…  commands that retrieve information (and objects), but for actually creating and configuring the networking, you’re going to be using an XML formatted document that has (by default) a .netcfg extension, and then using Set-AzureVNetConfig to upload that file.  And then we use New-AzureVNetGateway and Set-AzureVNetGateway to configure and connect the gateway. 

Again, in Bob’s article, we created a network.   So as a starting point for creating the network using PowerShell, I’m going to use Get-AzureVNetConfig to retrieve his configuration into a .netcfg file.

Get-AzureVNetConfig -ExportToFile C:\Users\kevrem\Desktop\MyAzureNetworks.netcfg

And the resulting file looks something like this:

-----

<?xml version="1.0" encoding="utf-8"?>
<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>
      <DnsServers>
         <DnsServer name="YourDNS" IPAddress="10.1.0.4" />
      </DnsServers>
    </Dns>
    <LocalNetworkSites>
      <LocalNetworkSite name="YourCorpHQ">
        <AddressSpace>
          <AddressPrefix>10.0.0.0/24</AddressPrefix>
        </AddressSpace>
        <VPNGatewayAddress>XXX.XXX.XXX.XXX</VPNGatewayAddress>
      </LocalNetworkSite>
    </LocalNetworkSites>
    <VirtualNetworkSites>
      <VirtualNetworkSite name="YourVirtualNetwork" AffinityGroup="KevRemWestUS">
        <AddressSpace>
          <AddressPrefix>10.4.0.0/16</AddressPrefix>
        </AddressSpace>
        <Subnets>
          <Subnet name="FrontEndSubnet">
            <AddressPrefix>10.4.2.0/24</AddressPrefix>
          </Subnet>
          <Subnet name="BackEndSubnet">
            <AddressPrefix>10.4.3.0/24</AddressPrefix>
          </Subnet>
          <Subnet name="ADDNSSubnet">
            <AddressPrefix>10.4.4.0/24</AddressPrefix>
          </Subnet>
          <Subnet name="GatewaySubnet">
            <AddressPrefix>10.4.1.0/24</AddressPrefix>
          </Subnet>
        </Subnets>
        <DnsServersRef>
          <DnsServerRef name="YourDNS" />
        </DnsServersRef>
        <Gateway>
          <ConnectionsToLocalNetwork>
            <LocalNetworkSiteRef name="YourCorpHQ" />
          </ConnectionsToLocalNetwork>
        </Gateway>
      </VirtualNetworkSite>
    </VirtualNetworkSites>
  </VirtualNetworkConfiguration>
</NetworkConfiguration>

-----

Go ahead and copy/paste the above text into Notepad, and save it as a file named MyAzureNetworks.netcfg

Now please note the highlighted portions. Those are unique for your account.  You’ll need to put your own public VPN gateway address, and use your own pre-created affinity group

Also note the bold text.  These are the items that you customize.  Put your own names and desired addresses in there, such as your DNS Server name and address.  Remove or add <Subnet> </Subnet> sections, or <Subnets>. 

But once you have that information, you should be able to use this file with the Set-AzureVNetConfig PowerShell cmdlet to create the same network and subnets.  If you’ve saved the file (let’s say to the root of your C:\ drive), and you have the Windows Azure PowerShell window open and connected..

“How do I know it’s connected?”

Try this PowerShell command:

Get-AzureSubscription

This should return some details on your connected subscription.

Anyway, once that’s verified, and as a first test of creating a network using PowerShell, run this:

Set-AzureVNetConfig -ConfigurationPath C:\MyAzureNetworks.netcfg

This should return successful. 

Now open up the Windows Azure Portal, login, and click on the Networks tab.  Do you see something like this?:

image

“Yes, I do!”

Good job!  Click on the Local Networks, DNS Servers, and Affinity Groups tabs.  You should see the values assigned and items created that match what you configured.

Back in Virtual Networks… Clicking on the network name and opening up the network details should look something like this:

image

Do you see the problem?  We haven’t yet created and enabled the gateway.  We can do that with PowerShell, too.

 

Create the Gateway

To do this, we’ll use the New-AzureVNetGateway command, and specify the name we used for our Azure NetworkThe command for our example looks like this:

New-AzureVNetGateway –VNetName “YourVirtualNetwork”

Once you run that, if you refresh the Windows Azure Portal screen, you’ll see this:

image

The creation of the gateway may take as long as 15 minutes.  You can also check the status of this creation by using the Get-AzureVNetGateway cmdlet.

image

 

In fact, you can see from my result in PowerShell that my gateway creation has completed, and my gateway address assigned.  Now the Windows Azure Portal looks like this:

 

image

 

But we still have one more thing to accomplish.  We haven’t yet connected our Azure network to our corporate network.

 

Connect the Gateway

This is also very simple: Set-AzureVNetGateway is the cmdlet we’ll use. 

Set-AzureVNetGateway -Connect –LocalNetworkSiteName “YourCorpHQ” –VNetName “YourVirtualNetwork”

image

Which shows up on the Windows Azure Portal like this:

image

Of course, it’s not going to succeed in connecting until we actually have something to connect to on the corporate side.  As you’ll recall, there are specific VPN endpoint devices that are supported on the corporate side, and to configure them you can use the Windows Azure Portal to download the Configuration as well as the Shared Key.

“But.. can you do that with PowerShell, too?”

Absolutely.  Well, two out of three, anyway…

 

Get the Gateway IP Address and Shared Key

There are three things you’ll need to configure the VPN device on your corporate side:

  1. The Gateway IP Address
  2. The Shared Key, and
  3. A Device Configuration Script

You can use the Get-AzureVNetGateway cmdlet to find the Gateway IP Address:

Get-AzureVNetGateway -VNetName YourVirtualNetwork

image

To get the shared key, use the Get-AzureVNetGatewayKey cmdlet:

Get-AzureVNetGatewayKey -LocalNetworkSiteName YourCorpHQ -VNetName YourVirtualNetwork

image

For the getting a script that will automatically configure your device, you’re still want to use the Windows Azure Portal.  Down at the bottom of the page while looking at your network dashboard, you see the “Download” button:

image 

Click that, and then walk through the wizard to select your device type and version information.

DwnldVPNConfig

The result will be a script that can be used by your VPN / Network administrator to configure the device.  You can get the VPN configuration script from the Management Portal or from the About VPN Devices for Virtual Network section of the MSDN library.  For more information, see Establish a Site-to-Site VPN Connection and your VPN device documentation.

The remainder of this article is “borrowed” directly from the end of Bob Hunt’s excellent article:

The procedure assumes the following:

  • The VPN device has been configured at your company.

To configure the VPN device:

  1. Modify the VPN configuration script. You will configure the following:

    a. Security policies

    b. Incoming tunnel

    c. Outgoing tunnel

  2. Run the modified VPN configuration script to configure your VPN device.

  3. Test your connection by running one of the following commands:

Cisco ASA

Cisco ISR/ASR

Juniper SSG/ISG

Juniper SRX/J

Check main mode SAs

show crypto isakmp sa

show crypto isakmp sa

get ike cookie

show security ike security-association

Check quick mode SAs

show crypto ipsec sa

show crypto ipsec sa

get sa

show security ipsec security-association

Once the Virtual Network tests out, you’re ready to go.  Enjoy!

Thanks, Bob.  I think we will!

---

Try Windows Azure free for 90 days

Read the original blog entry...

More Stories By Kevin Remde

Kevin is an engaging and highly sought-after speaker and webcaster who has landed several times on Microsoft's top 10 webcast list, and has delivered many top-scoring TechNet events and webcasts. In his past outside of Microsoft, Kevin has held positions such as software engineer, information systems professional, and information systems manager. He loves sharing helpful new solutions and technologies with his IT professional peers.

A prolific blogger, Kevin shares his thoughts, ideas and tips on his “Full of I.T.” blog (http://aka.ms/FullOfIT). He also contributes to and moderates the TechNet Forum IT Manager discussion (http://aka.ms/ITManager), and presents live TechNet Events throughout the central U.S. (http://www.technetevents.com). When he's not busy learning or blogging about new technologies, Kevin enjoys digital photography and videography, and sings in a band. (Q: Midlife crisis? A: More cowbell!) He continues to challenge his TechNet Event audiences to sing Karaoke with him.

@CloudExpo Stories
SYS-CON Events announced today that Parasoft will exhibit at SYS-CON's 15th International Cloud Expo®, which will take place on November 4–6, 2014, at the Santa Clara Convention Center in Santa Clara, CA. For 27 years, Parasoft has researched and developed software solutions that help organizations deliver defect-free software efficiently. By integrating Development Testing, API/cloud/SOA/composite app testing, and service virtualization, we reduce the time, effort, and cost of delivering secur...
Dyn solutions are at the core of Internet Performance. Through traffic management, message management and performance assurance, Dyn is connecting people through the Internet and ensuring information gets where it needs to go, faster and more reliably than ever before. Founded in 2001 at WPI, Dyn’s global presence services more than four million enterprise, small business and personal customers.
European data center operator DEAC is the largest in the Baltics. The activities are orientated to provide data center services and IT outsourcing on Eurasia and America scale in order to create the primary or backup or additional data center for customer in the EU, to protect its business and, most importantly, reduce costs up to 40% within 3-5 years. DEAC is an IT outsourcing services and solutions company whose highly experienced and qualified employees offer various groups of services and...
Until recently, many organizations required specialized departments to perform mapping and geospatial analysis, and they used Esri on-premise solutions for that work. In his session at 15th Cloud Expo, Dave Peters, author of the Esri Press book Building a GIS, System Architecture Design Strategies for Managers, will discuss how Esri has successfully included the cloud as a fully integrated SaaS expansion of the ArcGIS mapping platform. Organizations that have incorporated Esri cloud-based appl...
The Internet of Things will greatly expand the opportunities for data collection and new business models driven off of that data. In her session at Internet of @ThingsExpo, Esmeralda Swartz, CMO of MetraTech, will discuss how for this to be effective you not only need to have infrastructure and operational models capable of utilizing this new phenomenon, but increasingly service providers will need to convince a skeptical public to participate. Get ready to show them the money! Speaker Bio: ...
Samsung VP Jacopo Lenzi, who headed the company's recent SmartThings acquisition under the auspices of Samsung's Open Innovaction Center (OIC), answered a few questions we had about the deal. This interview was in conjunction with our interview with SmartThings CEO Alex Hawkinson. IoT Journal: SmartThings was developed in an open, standards-agnostic platform, and will now be part of Samsung's Open Innovation Center. Can you elaborate on your commitment to keep the platform open? Jacopo Lenzi: S...
The major cloud platforms defy a simple, side-by-side analysis. Each of the major IaaS public-cloud platforms offers their own unique strengths and functionality. Options for on-site private cloud are diverse as well, and must be designed and deployed while taking existing legacy architecture and infrastructure into account. Then the reality is that most enterprises are embarking on a hybrid cloud strategy and programs. In this Power Panel at 15th Cloud Expo, moderated by Ashar Baig, Research ...
Things are being built upon cloud foundations to transform organizations. This CEO Power Panel at 15th Cloud Expo, moderated by Roger Strukhoff, Cloud Expo and @ThingsExpo conference chair, will address the big issues involving these technologies and, more important, the results they will achieve. How important are public, private, and hybrid cloud to the enterprise? How does one define Big Data? And how is the IoT tying all this together?
When an enterprise builds a hybrid IaaS cloud connecting its data center to one or more public clouds, security is often a major topic along with the other challenges involved. Security is closely intertwined with the networking choices made for the hybrid cloud. Traditional networking approaches for building a hybrid cloud try to kludge together the enterprise infrastructure with the public cloud. Consequently this approach requires risky, deep "surgery" including changes to firewalls, subnets...
Ixia develops amazing products so its customers can connect the world. Ixia helps its customers provide an always-on user experience through fast, secure delivery of dynamic connected technologies and services. Through actionable insights that accelerate and secure application and service delivery, Ixia's customers benefit from faster time to market, optimized application performance and higher-quality deployments.
SYS-CON Events announced today that Stratogent will exhibit at SYS-CON's 15th International Cloud Expo®, which will take place on November 4–6, 2014, at the Santa Clara Convention Center in Santa Clara, CA. Stratogent is a custom managed services organization based in San Mateo, California. We design, implement, and support mission critical infrastructure 24x7 on premises, in datacenters and in the Cloud. Since 2005, we have acted as an extension of internal IT teams, achieving a customer reten...
SYS-CON Events announces a new pavilion on the Cloud Expo floor where WebRTC converges with the Internet of Things. Pavilion will showcase WebRTC and the Internet of Things. The Internet of Things (IoT) is the most profound change in personal and enterprise IT since the creation of the Worldwide Web more than 20 years ago. All major researchers estimate there will be tens of billions devices--computers, smartphones, tablets, and sensors – connected to the Internet by 2020. This number will con...
The only place to be June 9-11 is Cloud Expo & @ThingsExpo 2015 East at the Javits Center in New York City. Join us there as delegates from all over the world come to listen to and engage with speakers & sponsors from the leading Cloud Computing, IoT & Big Data companies. Cloud Expo & @ThingsExpo are the leading events covering the booming market of Cloud Computing, IoT & Big Data for the enterprise. Speakers from all over the world will be hand-picked for their ability to explore the economic...
SYS-CON Events announced today that Cloudian, Inc., the leading provider of hybrid cloud storage solutions, has been named “Bronze Sponsor” of SYS-CON's 15th International Cloud Expo®, which will take place on November 4–6, 2014, at the Santa Clara Convention Center in Santa Clara, CA. Cloudian is a Foster City, Calif.-based software company specializing in cloud storage. Cloudian HyperStore® is an S3-compatible cloud object storage platform that enables service providers and enterprises to bui...
SYS-CON Events announced today that Gridstore™, the leader in software-defined storage (SDS) purpose-built for Windows Servers and Hyper-V, will exhibit at SYS-CON's 15th International Cloud Expo®, which will take place on November 4–6, 2014, at the Santa Clara Convention Center in Santa Clara, CA. Gridstore™ is the leader in software-defined storage purpose built for virtualization that is designed to accelerate applications in virtualized environments. Using its patented Server-Side Virtual C...
As the Internet of Things unfolds, mobile and wearable devices are blurring the line between physical and digital, integrating ever more closely with our interests, our routines, our daily lives. Contextual computing and smart, sensor-equipped spaces bring the potential to walk through a world that recognizes us and responds accordingly. We become continuous transmitters and receivers of data. In his session at Internet of @ThingsExpo, Andrew Bolwell, Director of Innovation for HP’s Printing a...
SAP is delivering break-through innovation combined with fantastic user experience powered by the market-leading in-memory technology, SAP HANA. In his General Session at 15th Cloud Expo, Thorsten Leiduck, VP ISVs & Digital Commerce, SAP, will discuss how SAP and partners provide cloud and hybrid cloud solutions as well as real-time Big Data offerings that help companies of all sizes and industries run better. SAP launched an application challenge to award the most innovative SAP HANA and SAP ...
The Internet of Things (IoT) promises to evolve the way the world does business; however, understanding how to apply it to your company can be a mystery. Most people struggle with understanding the potential business uses or tend to get caught up in the technology, resulting in solutions that fail to meet even minimum business goals. In his session at Internet of @ThingsExpo, Jesse Shiah, CEO / President / Co-Founder of AgilePoint Inc., will show what is needed to leverage the IoT to transform...
SYS-CON Events announced today that AIC, a leading provider of OEM/ODM server and storage solutions, will exhibit at SYS-CON's 16th International Cloud Expo®, which will take place on June 9-11, 2015, at the Javits Center in New York City, NY. AIC is a leading provider of both standard OTS, off-the-shelf, and OEM/ODM server and storage solutions. With expert in-house design capabilities, validation, manufacturing and production, AIC's broad selection of products are highly flexible and are conf...
We are all here because we are sold on the transformative promise of The Cloud. But what good is all of this ephemeral, on-demand infrastructure if your usage doesn't actually improve the agility and speed of your business? How must Operations adapt in order to avoid stifling your Cloud initiative? In his session at DevOps Summit, Damon Edwards, co-founder and managing partner of the DTO Solutions, will highlight the successful organizational, process, and tooling patterns of high-performing c...