<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Fabric Controller</title>
	<atom:link href="http://fabriccontroller.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://fabriccontroller.net</link>
	<description>A blog dedicated to the Windows Azure platform</description>
	<lastBuildDate>Thu, 16 May 2013 19:15:23 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.1</generator>
		<item>
		<title>SignalR 1.1 Scale Out on Windows Azure with the Windows Azure Service Bus</title>
		<link>http://fabriccontroller.net/blog/posts/signalr-1-1-scale-out-on-windows-azure-with-the-windows-azure-service-bus/</link>
		<comments>http://fabriccontroller.net/blog/posts/signalr-1-1-scale-out-on-windows-azure-with-the-windows-azure-service-bus/#comments</comments>
		<pubDate>Wed, 15 May 2013 01:06:10 +0000</pubDate>
		<dc:creator>sandrinodimattia</dc:creator>
				<category><![CDATA[Windows Azure Service Bus]]></category>
		<category><![CDATA[SignalR]]></category>

		<guid isPermaLink="false">http://fabriccontroller.net/?p=838</guid>
		<description><![CDATA[SignalR has been around for a while now and people are using it to build stunning real-time applications. While this worked fine on a single server deployment, there was no production ready support for running it on a multi server environment (like Windows Azure). A little over a year ago Clemens Vasters released the Windows [...]]]></description>
			<content:encoded><![CDATA[<p>SignalR has been around for a while now and people are using it to build stunning real-time applications. While this worked fine on a single server deployment, there was no production ready support for running it on a multi server environment (like Windows Azure). A little over a year ago Clemens Vasters released the <a href="http://vasters.com/clemensv/2012/02/13/SignalR+Powered+By+Service+Bus.aspx">Windows Azure Service Bus backplane for SignalR</a> which made it possible to deploy SignalR in a web farm. This backplane has been in beta for over a year&#8230; but this changed with the release of SignalR 1.1:</p>
<p><img class="alignnone size-full wp-image-840" title="Step1-Tweet" src="http://fabriccontroller.net/wp-content/uploads/Step1-Tweet.png" alt="" width="476" height="197" /></p>
<p>In this article we&#8217;re going to take the <a href="http://www.asp.net/signalr/overview/getting-started/tutorial-getting-started-with-signalr">Getting Started sample</a>, make it scalable with the Service Bus backplane and deploy it to a Windows Azure Cloud Service with 4 instances. Let&#8217;s get started!</p>
<h2>Creating the application</h2>
<p>So the first thing I did was create a new Azure project in Visual Studio with a simple ASP.NET Web Role. After that I added the <strong>Microsoft.AspNet.SignalR</strong> and <strong>Microsoft.AspNet.SignalR.ServiceBus</strong> packages to the Web Role project:</p>
<p><img class="alignnone size-full wp-image-846" title="Step2-Package" src="http://fabriccontroller.net/wp-content/uploads/Step2-Package.png" alt="" width="824" height="450" /></p>
<p>And after adding the packages I did 2 simple things, creating a hub and creating the &#8220;chat page&#8221; (this is all based on the Getting Started sample). The hub is very simple, the only thing it includes is the <strong>Send</strong> method. If you compare this to the original hub in the Getting Started sample you&#8217;ll see that I added some extra information to the broadcast: the name of the machine and the ID of the instance. If you&#8217;re doing this on-premises you can just remove the last argument.</p>
<script src="http://gist.github.com/e9ab4cfbbe1bf7e5921b.js"></script>
<p>And the chat page is also fairly simple. I also made some changes to this code to display some info about the instance where the message was sent to (this is the server which sent out the broadcast).</p>
<script src="http://gist.github.com/99f6b49b8975cfc280a3.js"></script>
<p>Finally I created a Global.asax file in which I initialized the Service Bus backplane together with the SignalR routing:</p>
<script src="http://gist.github.com/35933988c7b4f5c00cc6.js"></script>
<p>As you can see from this code I&#8217;m using the <strong>CloudConfigurationManager </strong>class to get the connection string to my Service Bus namespace. If I&#8217;m running in a Windows Azure Cloud Service, the CloudConfigurationManager will get the setting from the Service Configuration (which can be changed after deploying the application). If the application runs as a normal web application (on-premises, in a Windows Azure Web Site, &#8230;) it will get the setting from the app/web.config</p>
<p><img class="alignnone size-large wp-image-851" title="Step3-ServiceConfiguration" src="http://fabriccontroller.net/wp-content/uploads/Step3-ServiceConfiguration-1024x203.png" alt="" width="1024" height="203" /></p>
<p>But before you can get the connection string you&#8217;ll need to create a new Service Bus namespace (or get the connection string for an existing namespace).</p>
<h2>Service Bus Namespace</h2>
<p>Creating a new namespace is easy, simply go to the Windows Azure Portal under <strong>Service Bus</strong> and press the <strong>Create</strong> button. After a few seconds the namespace will have been created and you&#8217;ll be able to click the <strong>Access Key </strong>button:</p>
<p><img class="alignnone size-full wp-image-852" title="Step5-Namespace" src="http://fabriccontroller.net/wp-content/uploads/Step5-Namespace.png" alt="" width="550" height="490" /></p>
<p>This is where you&#8217;ll be able to see the connection string which you can copy to your Service Configuration or to your web.config (depending if you&#8217;re deploying to a Cloud Service or not).</p>
<p><strong>Note</strong>: Don&#8217;t use the owner account in production. Instead, click the Open ACS Management Portal link to create additional Service Identity for that namespace with limited permissions.</p>
<h2>Deploy and test</h2>
<p>As you can see it was really easy to add the Service Bus backplane. The last thing left to do is deploy the application. I decided to deploy it as a Cloud Service with 4 instances:</p>
<p><img class="alignnone size-full wp-image-853" title="Step6-Instances" src="http://fabriccontroller.net/wp-content/uploads/Step6-Instances.png" alt="" width="805" height="330" /></p>
<p>And now the only thing I had left to do was to test it out. I opened a few different tabs in IE to make sure that I would be connecting to different instances at the same time.</p>
<p><img class="alignnone size-large wp-image-854" title="Step7-Demo" src="http://fabriccontroller.net/wp-content/uploads/Step7-Demo-1024x650.png" alt="" width="1024" height="650" /></p>
<p>As you can see I&#8217;m sending the chat message to different servers which still manage to broadcast it to all connected clients thanks to the Service Bus backplane. And in the Windows Azure portal you&#8217;ll also be able to see that the Service Bus backplane created a topic for your application and a subscription for each instance in your Web Role:</p>
<p><img class="alignnone size-full wp-image-855" title="Step5-TopicsAndSubscriptions" src="http://fabriccontroller.net/wp-content/uploads/Step5-TopicsAndSubscriptions.png" alt="" width="953" height="197" /></p>
<p>The code for this sample is available on GitHub: <a href="https://github.com/sandrinodimattia/WindowsAzure-SignalRScaleOutDemo">https://github.com/sandrinodimattia/WindowsAzure-SignalRScaleOutDemo</a></p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://fabriccontroller.net/blog/posts/signalr-1-1-scale-out-on-windows-azure-with-the-windows-azure-service-bus/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Reference implementation: Creating a hybrid cloud with Windows Azure Virtual Networks software based Site-to-Site VPN</title>
		<link>http://fabriccontroller.net/blog/posts/reference-implementation-for-windows-azure-virtual-networks-software-based-site-to-site-vpn/</link>
		<comments>http://fabriccontroller.net/blog/posts/reference-implementation-for-windows-azure-virtual-networks-software-based-site-to-site-vpn/#comments</comments>
		<pubDate>Sun, 05 May 2013 23:36:55 +0000</pubDate>
		<dc:creator>sandrinodimattia</dc:creator>
				<category><![CDATA[Windows Azure Virtual Machines]]></category>
		<category><![CDATA[Windows Azure Virtual Networks]]></category>
		<category><![CDATA[Routing and Remote Access]]></category>
		<category><![CDATA[Site to Site VPN]]></category>
		<category><![CDATA[Virtual Networks]]></category>

		<guid isPermaLink="false">http://fabriccontroller.net/?p=803</guid>
		<description><![CDATA[After Microsoft announced software based Site-to-Site VPN support between Windows Azure Virtual Networks and Windows Server 2012 Routing And Remote Access I wrote a blog post on how easy it is to configure all of this: Setting up software based Site-to-Site VPN for Windows Azure with Windows Server 2012 Routing and Remote Access. I got lot [...]]]></description>
			<content:encoded><![CDATA[<p>After Microsoft announced software based Site-to-Site VPN support between Windows Azure Virtual Networks and Windows Server 2012 Routing And Remote Access I wrote a blog post on how easy it is to configure all of this: <a href="http://fabriccontroller.net/blog/posts/setting-up-software-based-site-to-site-vpn-for-windows-azure-with-windows-server-2012-routing-and-remote-access/">Setting up software based Site-to-Site VPN for Windows Azure with Windows Server 2012 Routing and Remote Access</a>. I got lot of positive response on that post and a few people also asked me how they could get this to work in a real corporate network.</p>
<p>That&#8217;s why I decided to write this post&#8230; I&#8217;ll be covering step by step how Contoso moved from everything in their datacenter to a hybrid setup with their datacenter and Windows Azure Virtual Machines, connected with the Site-to-Site VPN available in Virtual Networks.</p>
<h2>The original setup</h2>
<p>This is how Contoso looked like before moving to Windows Azure. Besides the standard infrastructure like AD, DNS, &#8230; their network included the following:</p>
<ol>
<li>A firewall + router which was directly connected to the internet. Everything behind that firewall + router was using NAT.</li>
<li>A developer (Contoso-DEV) connected to the wireless network. This wireless network was connected to the router.</li>
<li>A webserver (Contoso-WEB001). Using port forwarding (port 80 and 443) this server was available from the internet. Developers from within the network were able to connect to the machine using Remote Desktop, but this was only possible if they were connected to the corporate network.</li>
<li>A database server (Contoso-SQL001) which was not publicly available. Only the webserver and the developer workstations were able to access it.</li>
</ol>
<p><img class="alignnone size-full wp-image-830" title="Step1-ContosoBefore" src="http://fabriccontroller.net/wp-content/uploads/Step1-ContosoBefore2.png" alt="" width="831" height="480" /><br />
Contoso decided to resell their application in a few additional countries so they needed some extra power. And instead of investing in additional hardware, licenses, &#8230; they decided to go for Windows Azure. The plan was to have multiple webservers running in Windows Azure depending on number of additional customers. If it would turn out that the application wasn&#8217;t selling good enough in these countries, they could just remove the Virtual Machines and that would be the end of it. They loss they would suffer would be minimal.</p>
<h2>Preparing the hardware and the network</h2>
<p>The first thing I did was install a new physical server with Windows Server 2012. Now take a look at the following picture:</p>
<p><img class="alignnone size-full wp-image-809" title="Step2-AddRRAS" src="http://fabriccontroller.net/wp-content/uploads/Step2-AddRRAS1.png" alt="" width="612" height="816" /></p>
<p>The image in the lower left corner represents my new server. As you can see this server has a public IP since it&#8217;s connected to my modem, but it also comes with an internal IP since it&#8217;s connected to the firewall/router. The important thing to know here is that you machine needs direct access to the internet, meaning no NAT or blocked ports. If that&#8217;s not possible for you, I think it all ends here. Here in Belgium I think it&#8217;s almost impossible to get this on a residential line, so I had to buy a new modem + upgrade my internet subscription in order to get this.</p>
<p>Ok so let&#8217;s take a look at what we&#8217;ve done so far:</p>
<ol>
<li>Install a Windows Server 2012 (name: Contoso-RRAS)</li>
<li>Connect this server to the internet using a direct connection <strong>without NAT </strong>(so no firewalls, routers, &#8230; between your server and the internet)!</li>
<li>Connect this server to our corporate network. For this connection, NAT is OK</li>
</ol>
<p>And this is how an <strong>ipconfig</strong> on the new server looks like:</p>
<p><img class="alignnone size-full wp-image-810" title="Step3-IpConfig" src="http://fabriccontroller.net/wp-content/uploads/Step3-IpConfig.png" alt="" width="842" height="490" /></p>
<p>Here you can clearly see the 2 network interfaces: Ethernet is the one connected to the internet and the Wireless one is the one connected to the corporate network. Note that for the connection to my corporate network I&#8217;ve set this to a fixed IP address and remove the gateway (explained here: <a href="http://blog.concurrency.com/featured-post/site-to-azure-vpn-using-windows-server-2012-rras/">http://blog.concurrency.com/featured-post/site-to-azure-vpn-using-windows-server-2012-rras/</a>).</p>
<h2>Creating the Local Network in Windows Azure</h2>
<p>The first thing we&#8217;ll need to do in Windows Azure is define our local network. You can create a new local network under <strong>Networks &gt; New &gt; Add Local Network</strong>. Start by giving it a name and the IP address of the new Windows Server (in my case the public IP address of Contoso-RRAS, <strong>93.221.80.21</strong>).</p>
<p><img class="alignnone size-full wp-image-811" title="Step3-LocalNetwork" src="http://fabriccontroller.net/wp-content/uploads/Step3-LocalNetwork.png" alt="" width="708" height="488" /></p>
<p>On the next page I&#8217;ll enter the internal IP range of the corporate network (this matches the second IP address you saw in the <strong>ipconfig</strong> screenshot):</p>
<p><img class="alignnone size-full wp-image-812" title="Step4-IpRange" src="http://fabriccontroller.net/wp-content/uploads/Step4-IpRange.png" alt="" width="666" height="480" /></p>
<p>And that&#8217;s it, your corporate network has been defined in Windows Azure. Next stop, creating a Virtual Network!</p>
<h2>Creating the Virtual Network in Windows Azure</h2>
<p>So I created a new Virtual Network which I called Contoso-AZURE:</p>
<p><img class="alignnone size-full wp-image-813" title="Step5-CreateVNET" src="http://fabriccontroller.net/wp-content/uploads/Step5-CreateVNET.png" alt="" width="992" height="671" /></p>
<p>On the next page I defined the DNS server which runs on-premises (in my case 10.0.0.9). This is really important if you want your Virtual Machine to resolve your local resources like a SQL Server (in my case that would be Contoso-SQL001). And on the third page I configured the Virtual Network with a subnet called <strong>Web-Frontends</strong> and a gateway subnet. The <strong>Web-Frontends</strong> subnet will hold the Virtual Machines running the webapplication.</p>
<p><img class="alignnone size-full wp-image-814" title="Step6-Network" src="http://fabriccontroller.net/wp-content/uploads/Step6-Network.png" alt="" width="971" height="660" /></p>
<p>After a few seconds the Virtual Network will be created. Now it&#8217;s time to set up the gateway as described in my previous post: <a href="http://fabriccontroller.net/blog/posts/setting-up-software-based-site-to-site-vpn-for-windows-azure-with-windows-server-2012-routing-and-remote-access/">Setting up software based Site-to-Site VPN for Windows Azure with Windows Server 2012 Routing and Remote Access</a>.</p>
<ol>
<li>In the Virtual Network, create a gateway with static routing</li>
<li>Download the VPN Device Script for Microsoft / RRAS</li>
<li>Replace the weird characters in that file</li>
<li>Replace the settings in that file</li>
<li>Save the file as a *.ps1 file</li>
<li>Run it on the new server (in my case Contoso-RRAS)</li>
<li>Wait for the installation to complete</li>
</ol>
<p>Here&#8217;s how I replaced the variables in that file, it might be a useful reference for when you&#8217;re comparing this with your own environment:</p>
<ul>
<li>SP_AzureGatewayIpAddress: <strong>137.117.x.x</strong> (the IP address you&#8217;ll see in your Virtual Network after creating the gateway with static routing)</li>
<li>SP_AzureNetworkCIDR: <strong>10.1.0.0/16</strong> (the address space of my Virtual Network, see previous screenshot)</li>
<li>SP_AzureNetworkMetric: <strong>10</strong></li>
<li>SP_PresharedKey: the key you&#8217;ll find when clicking <strong>Manage Key</strong> in your Virtual Network</li>
</ul>
<p>After running the script on your new server you&#8217;ll see that the Routing and Remote Access Role has been configured. Open up RRAS and go to Network Interfaces. This is where you&#8217;ll see the gateway as a Demand-dial interface. Right click it and press Connect. The first time I had to do this a few times before it worked (Disconnect / Connect / Disconnect / Connect / &#8230;). After the first time everything kept working OK:</p>
<p><img class="alignnone size-large wp-image-815" title="Step7-Connect" src="http://fabriccontroller.net/wp-content/uploads/Step7-Connect3-1024x222.png" alt="" width="1024" height="222" /></p>
<h2>Creating the Virtual Machines</h2>
<p>So the first part of the network configuration is done. Now we&#8217;re going to setup a new Virtual Machine which will allow the developers to deploy the application. And after that we will remove the web server which runs on-premises (in a real project this would keep running in parallel for a few days/weeks).</p>
<p>For the first Virtual Machine I had to create it as a stand-alone Virtual Machine. And it&#8217;s on this page that I decide to link the Virtual Machine to the <strong>Contoso-AZURE </strong>Virtual Network and in which subnet to place it (the Web-Frontends subnet). Finally on the next page I decided to create an availability set called <strong>WebFrontEnds</strong> in order to get the 99,95% SLA when I connect a second machine.</p>
<p><img class="alignnone size-full wp-image-816" title="Step8-ContosoWebFront" src="http://fabriccontroller.net/wp-content/uploads/Step8-ContosoWebFront.png" alt="" width="910" height="665" /></p>
<p>Immediately after creating the first machine I created the second machine, but for that one I connected it to the first virtual machine:</p>
<p><img class="alignnone size-full wp-image-817" title="Step9-ConnectToVM" src="http://fabriccontroller.net/wp-content/uploads/Step9-ConnectToVM.png" alt="" width="902" height="661" /></p>
<p>After a few minutes you&#8217;ll see the Virtual Machines popping up in your Virtual Network:</p>
<p><img class="alignnone size-full wp-image-819" title="Step10-Resources" src="http://fabriccontroller.net/wp-content/uploads/Step10-Resources1.png" alt="" width="901" height="427" /></p>
<p>Did you notice that both machines received an IP address which matches the <strong>Web-Frontends</strong> subnet. This is how we&#8217;ll be able to address the Virtual Machines from our corporate network.</p>
<h2>Time for some Routing</h2>
<p>The networks have been connected, the web application has been migrated to Windows Azure Virtual Machines. This means we only have one task left: configure the routing to make sure that our developers can connect to the Virtual Machines from within our corporate network and to make sure that the Virtual Machines can access the SQL Server running on-premises.</p>
<p>You might be thinking that the developers already have access to the Virtual Machines (since they deployed the web application on the Virtual Machines). That&#8217;s true, but in order to do so they had to connect though the public endpoint for Remote Desktop. Now this might be a possible security risk, since anyone with an internet connection could be able to connect to your Virtual Machine (this leaves the door open for brute force attacks). Go ahead and remove these public endpoints and make sure you open ports which are really required for your application like HTTP or HTTPS:</p>
<p><img class="alignnone size-full wp-image-820" title="Step11-HTTP" src="http://fabriccontroller.net/wp-content/uploads/Step11-HTTP.png" alt="" width="724" height="265" /></p>
<p>The next step will depend on the type of firewall you have in your corporate network. Since I&#8217;m doing this at home I don&#8217;t have a fancy firewall, but I&#8217;m using a Netgear Genie WNDR4000 instead (which is my firewall + router). But this doesn&#8217;t really matter. The only thing you&#8217;ll need to do is setup routing in your firewall. In my case I created a static route to my <strong>Web-Frontends</strong> subnet:</p>
<p><img class="alignnone size-full wp-image-821" title="Step12-Routing" src="http://fabriccontroller.net/wp-content/uploads/Step12-Routing.png" alt="" width="972" height="472" /></p>
<p>Here is what this means:</p>
<ul>
<li>Name: I guess that&#8217;s obvious</li>
<li>Destination: the subnet you want to connect to (the one you defined in the Virtual Network). In my case this is the 10.1.0.0 range.</li>
<li>Gateway: the server that can &#8220;bring you there&#8221;. In my case this is the new server I deployed. This server is the only connected to Windows Azure using the Site-to-Site VPN and if you look back to the picture at the start of this post you&#8217;ll see that the IP address of the machine is: 10.0.0.2</li>
</ul>
<p>Once that&#8217;s done I&#8217;m able to connect to the Virtual Machine from the developer workstation (or any other machine in the corporate network connected to the firewall):</p>
<p><img class="alignnone size-full wp-image-823" title="Step13-RDP" src="http://fabriccontroller.net/wp-content/uploads/Step13-RDP1.png" alt="" width="816" height="639" /></p>
<p>But this also means we could use this for so many other scenarios like secure backup, secure Remote PowerShell, using Windows Shares, Web Deploy, integrating with System Center &#8230; And do you remember the DNS Server you assigned to your Virtual Network? Well, take a closer look: the Virtual Machine automatically uses this DNS Server. This means my Virtual Machine will be able to resolve the names of the machines in my corporate network.</p>
<p>Now the other way around just works thanks to RRAS, so from that Virtual Machine I&#8217;m able to ping any server in my corporate network like the SQL Server for example (10.0.0.4):</p>
<p><img class="alignnone size-full wp-image-824" title="Step14-PingSQL" src="http://fabriccontroller.net/wp-content/uploads/Step14-PingSQL.png" alt="" width="816" height="639" /></p>
<p>And we&#8217;re done! Our servers in the corporate network are able to connect with the Virtual Machines running in Windows Azure and those Virtual Machines can connect to our corporate network!</p>
<h2>Improving security</h2>
<p>Our RRAS server is connected to the internet without a firewall sitting in front of it. In order to improve security you could configure the firewall to only allow incoming connections from the internet coming from the gateway you created in the Virtual Network. For the VPN to work only these rules should be enabled for the public profile (besides the Core Networking rules):</p>
<p><img class="alignnone size-large wp-image-825" title="Step15-Firewall" src="http://fabriccontroller.net/wp-content/uploads/Step15-Firewall-1024x569.png" alt="" width="1024" height="569" /></p>
<h2>The End</h2>
<p>And there you go, this should be a good reference to get started with the Windows Azure Virtual Networks Site-to-Site VPN functionality for Routing and Remote Access. Here&#8217;s how the network looks like today:</p>
<p><img class="alignnone size-full wp-image-831" title="FinalStep-ContosoAfterMigration" src="http://fabriccontroller.net/wp-content/uploads/FinalStep-ContosoAfterMigration.png" alt="" width="982" height="982" /></p>
<p>Writing this article was very challenging for me (since I&#8217;m not an IT Pro) and it even cost me a few bucks (about 85€ for the line upgrade and the new modem), but I hope this can be a useful start for people who want to move their infrastructure to a hybrid cloud (with Windows Azure of course).</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://fabriccontroller.net/blog/posts/reference-implementation-for-windows-azure-virtual-networks-software-based-site-to-site-vpn/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Solving the &#8220;Virtual network myvnet is in use and cannot be deleted&#8221; issue when deleting a Windows Azure Virtual Network</title>
		<link>http://fabriccontroller.net/blog/posts/solving-the-virtual-network-myvnet-is-in-use-and-cannot-be-deleted-error-when-deleting-a-windows-azure-virtual-network/</link>
		<comments>http://fabriccontroller.net/blog/posts/solving-the-virtual-network-myvnet-is-in-use-and-cannot-be-deleted-error-when-deleting-a-windows-azure-virtual-network/#comments</comments>
		<pubDate>Fri, 03 May 2013 15:33:17 +0000</pubDate>
		<dc:creator>sandrinodimattia</dc:creator>
				<category><![CDATA[Windows Azure Virtual Networks]]></category>
		<category><![CDATA[Local Networks]]></category>
		<category><![CDATA[Virtual Networks]]></category>

		<guid isPermaLink="false">http://fabriccontroller.net/?p=792</guid>
		<description><![CDATA[The last few days I&#8217;ve been testing out many different things with Virtual Networks (especially Site-to-Site VPN). Today I tried cleaning up all the mess I made but I had a few Virtual Networks which I couldn&#8217;t delete. Every time I tried to delete a Virtual Network I got this error message: Virtual network &#8216;ContosoCloud&#8217; is [...]]]></description>
			<content:encoded><![CDATA[<p>The last few days I&#8217;ve been testing out many different things with Virtual Networks (especially Site-to-Site VPN). Today I tried cleaning up all the mess I made but I had a few Virtual Networks which I couldn&#8217;t delete.</p>
<p>Every time I tried to delete a Virtual Network I got this error message: <em>Virtual network &#8216;ContosoCloud&#8217; is in use and cannot be deleted. If you recently deleted resources, it might take some time to update the virtual network.</em></p>
<p><img class="alignnone size-full wp-image-793" title="Step1-DeleteError" src="http://fabriccontroller.net/wp-content/uploads/Step1-DeleteError.png" alt="" width="987" height="144" /></p>
<p>But my Virtual Network wasn&#8217;t in use because I made changes to it, it was in use because I didn&#8217;t remove the resources linking to this Virtual Network. This is what you&#8217;ll need to do to get rid of a Virtual Network and a Local Network (exactly in this order):</p>
<ol>
<li>The first step is to delete the gateway in your Virtual Network. This can take a few minutes, so you will need to wait for it to complete before you can continue:<br />
<img class="alignnone size-full wp-image-794" title="Step2-DeleteGateway" src="http://fabriccontroller.net/wp-content/uploads/Step2-DeleteGateway.png" alt="" width="981" height="153" /></li>
<li>Once you&#8217;ve deleted the Gateway you will need to delete the next link to this Virtual Network. You can find them them under resources in the dashboard of your Virtual Network.
<p><img class="alignnone size-full wp-image-795" title="Step3-DeleteVirtualMachines" src="http://fabriccontroller.net/wp-content/uploads/Step3-DeleteVirtualMachines.png" alt="" width="496" height="191" /></p>
<p>Don&#8217;t worry about deleting the Virtual Machine. By deleting them, you&#8217;re deleting nothing more than an XML file which describes where to find the data disk, the size of the VM, which ports to open, &#8230; So its very easy to re-create the Virtual Machine (with the same data) through the portal or by using PowerShell.</li>
<li>After removing the gateway and the resources you&#8217;ll be able to delete the Virtual Network.<br />
<img class="alignnone size-full wp-image-796" title="Step4-DeleteVNET" src="http://fabriccontroller.net/wp-content/uploads/Step4-DeleteVNET.png" alt="" width="341" height="104" /></li>
<li>And the final step, if you linked the Virtual Network to a Local Network you can now also remove the Local Network (which was referenced by the Virtual Network):
<p><img class="alignnone size-full wp-image-797" title="Step5-DeleteLocalNetwork" src="http://fabriccontroller.net/wp-content/uploads/Step5-DeleteLocalNetwork.png" alt="" width="446" height="273" /></li>
</ol>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://fabriccontroller.net/blog/posts/solving-the-virtual-network-myvnet-is-in-use-and-cannot-be-deleted-error-when-deleting-a-windows-azure-virtual-network/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introducing the Event-Driven Message Programming Model for the Windows Azure Service Bus</title>
		<link>http://fabriccontroller.net/blog/posts/introducing-the-event-driven-message-programming-model-for-the-windows-azure-service-bus/</link>
		<comments>http://fabriccontroller.net/blog/posts/introducing-the-event-driven-message-programming-model-for-the-windows-azure-service-bus/#comments</comments>
		<pubDate>Wed, 01 May 2013 00:35:47 +0000</pubDate>
		<dc:creator>sandrinodimattia</dc:creator>
				<category><![CDATA[Windows Azure Service Bus]]></category>
		<category><![CDATA[SDK 2.0]]></category>
		<category><![CDATA[Service Bus]]></category>
		<category><![CDATA[Worker Role]]></category>

		<guid isPermaLink="false">http://fabriccontroller.net/?p=768</guid>
		<description><![CDATA[Only a few days after announcing improvements to IaaS, Scott Guthrie announced the release of the Windows Azure SDK 2.0. This release improves the Visual Studio tooling, deployment, automation, &#8230; And besides that it also introduces some updates to the Windows Azure Service Bus. One of these updates is the new Event-Driven Message Programming Model [...]]]></description>
			<content:encoded><![CDATA[<p>Only a few days after <a href="http://weblogs.asp.net/scottgu/archive/2013/04/26/windows-azure-improvements-to-virtual-networks-virtual-machines-cloud-services-and-a-new-ruby-sdk.aspx">announcing</a> improvements to IaaS, Scott Guthrie announced the release of the Windows Azure SDK 2.0. This release improves the Visual Studio tooling, deployment, automation, &#8230; And besides that it also introduces some updates to the Windows Azure Service Bus. One of these updates is the new Event-Driven Message Programming Model (or message pump).</p>
<h2>How we used to do it</h2>
<p>When you create a new Windows Azure project in Visual Studio (a Cloud Service) you get to choose from different Web/Worker Role templates. One of these templates is the following: Worker Role with Service Bus Queue. This project is just a quick start that allows you to see how to receive and process messages coming from a Service Bus Queue from within a Worker Role:</p>
<script src="http://gist.github.com/ff1d64242b802a50d709.js"></script>
<p>By using the Receive method it was up to you to poll for messages, handle any exceptions, process multiple messages in parallel, Complete the message, &#8230; The new support for the Event-Driven Message Programming Model now does most of those things for you. Let&#8217;s take a look&#8230;</p>
<h2>Sample application</h2>
<p>To show this I created a sample application which requests and handles customer approvals. For this I&#8217;m using a simple class which contains the Id of the customer:</p>
<script src="http://gist.github.com/0ad72126a05b0e4de5f0.js"></script>
<p>And then we also have a sample console application which makes sure the queue exists and sends out a message (with the Id of a customer) to the queue. The message is sent each time you press Enter:</p>
<script src="http://gist.github.com/f8f898ce9950ec982123.js"></script>
<p>This is how sending the messages looks like:</p>
<p><img class="alignnone size-full wp-image-771" title="Step1-SendingMessages" src="http://fabriccontroller.net/wp-content/uploads/Step1-SendingMessages.png" alt="" width="677" height="559" /></p>
<h2>Receiver</h2>
<p>Instead of polling the queue we&#8217;ll be using the new message pump. Take a look at how easy it is to get messages from the queue:</p>
<script src="http://gist.github.com/ca7d0485fdf1bcc9e490.js"></script>
<p>The first thing that happens is setting up the options for the message pump by creating a new OnMessageOptions. This class allows us to define a few settings:</p>
<ul>
<li>AutoComplete: call Complete on the message after it has been processed (after we leave the OnMessageArrived method)</li>
<li>ExceptionReceived: the event to raise each time an error occurs</li>
<li>MaxConcurrentCalls: define how many theads will be processing the queue (for improved performance)</li>
</ul>
<p>After setting up OnMessageOptions we simply call OnMessage on the queue client with the method to execute each time a message arrives and the options. As you can see from my OnMessageArrived method I simply get the message and process it. I also introduced an exception for every 10th customer to automatically throw an exception. This allows us to test the ExceptionReceived method. Here is the result after I&#8217;ve sent a few messages:</p>
<p><img class="alignnone size-full wp-image-775" title="Step2-MessageReceiver" src="http://fabriccontroller.net/wp-content/uploads/Step2-MessageReceiver.png" alt="" width="677" height="499" /></p>
<p>As you can see the messages 1 &#8211; 9 are being processed very fast, and after processing each message, the message pump will set the message as complete (thanks to the <strong>AutoComplete</strong> option). But then for customer 10 we get an exception which will raise the ExceptionReceived even. In our case this will call the OnExceptionReceived method. This is typically the place where you&#8217;ll want to do something like logging the exception, sending out an email, &#8230;</p>
<p>Now the exception might not be a real problem. it could be possible that the issue is fixed the next time we process the message. That&#8217;s why it&#8217;s important <strong>not to handle the exception</strong> in the OnMessage action. If you handle the exception the message pump will not know anything went wrong and simply complete the message, which is something you don&#8217;t want. You want that, whenever something goes wrong, the message is retried for a few times. If it doesn&#8217;t work after a few times it will be placed in the Dead Letter Queue. But remember, this is only possible if you let the message pump handle the exception for you.</p>
<p>Finally we have the MaxConcurrentCalls option which is set to 5. This means that messages will be processed by a maximum of 5 different Threads in parallel, which increases the number of messages being processed on the receiver side. If you set this to 1 and re-run the application you&#8217;ll see that messages are being processed one by one. Anyways, this option makes it really easy to use more resources on your machine to process the messages.</p>
<h2>Receiver without AutoComplete</h2>
<p>Now there are times where you&#8217;ll need more control over your message, like when you want to complete it, when you want to abort it, &#8230; In that case you can set the <strong>AutoComplete</strong> option to <strong>false</strong>:</p>
<script src="http://gist.github.com/b2d681f7236d4c70e8d6.js"></script>
<p>This code is very similar to the previous example except for 2 small differeneces: <strong>AutoComplete</strong> is set to false and we&#8217;re handling when to complete the message ourselves. This example is fairly simple, it will complete the message only if it&#8217;s a valid customer. The great thing about <strong></strong>the<strong> AutoComplete</strong> option is that you can get more control if you need it. What you might notice is that I&#8217;m using a retry policy (TOPAZ) on my Complete method. This is to make sure we&#8217;re not affected by transient faults (ie: connection loss for a few seconds).</p>
<h2>Small but nice</h2>
<p>Now while this is a pretty small change, but it will make consuming messages from a Service Bus Queue / Subscriptions so much easier. Read more about the new release in the <a href="http://msdn.microsoft.com/en-us/library/dn198643.aspx">Release Notes</a>.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://fabriccontroller.net/blog/posts/introducing-the-event-driven-message-programming-model-for-the-windows-azure-service-bus/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Script to automatically configuring Remote PowerShell for Windows Azure Virtual Machines on your machine</title>
		<link>http://fabriccontroller.net/blog/posts/automatically-configuring-remote-powershell-for-windows-azure-virtual-machines-on-your-machine/</link>
		<comments>http://fabriccontroller.net/blog/posts/automatically-configuring-remote-powershell-for-windows-azure-virtual-machines-on-your-machine/#comments</comments>
		<pubDate>Mon, 29 Apr 2013 21:18:05 +0000</pubDate>
		<dc:creator>sandrinodimattia</dc:creator>
				<category><![CDATA[Windows Azure Virtual Machines]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Virtual Machines]]></category>

		<guid isPermaLink="false">http://fabriccontroller.net/?p=752</guid>
		<description><![CDATA[In my last post I explained how to leverage the support for Remote PowerShell in your Windows Azure Virtual Machines. While this is fairly easy to setup, it can get a little boring if you need to repeat this over and over again (especially the part with the certificates). A few weeks ago Michael Washam explained [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://fabriccontroller.net/blog/posts/using-remote-powershell-with-windows-azure-virtual-machines/">my last post</a> I explained how to leverage the support for Remote PowerShell in your Windows Azure Virtual Machines. While this is fairly easy to setup, it can get a little boring if you need to repeat this over and over again (especially the part with the certificates). A few weeks ago Michael Washam explained how to automate this with the Windows Azure PowerShell SDK: <a href="http://michaelwasham.com/2013/04/16/windows-azure-powershell-updates-for-iaas-ga/">Windows Azure PowerShell Updates for IaaS GA</a>.</p>
<p>From time to time I tend to suffer from the &#8220;not invented here&#8221; syndrome, so I decided to write a little script which would do the following:</p>
<ol>
<li>Parse a publish settings file to get the management certificate and the subscription ID</li>
<li>Find the public port for Remote PowerShell of a specific Virtual Machine</li>
<li>Download the certificate used by the Virtual Machine for Remote PowerShell</li>
<li>Install this certificate in the trusted root store</li>
<li>Give me some examples of how I could use Remote PowerShell for that machine</li>
</ol>
<p>The result: <strong>Enable-RemotePowerShellForVM.ps1 </strong>(<a href="https://github.com/sandrinodimattia/WindowsAzure-EnableRemotePowerShellForVM">download</a>)</p>
<div><img class="alignnone size-full wp-image-759" title="Step1-ExecuteScript" src="http://fabriccontroller.net/wp-content/uploads/Step1-ExecuteScript2.png" alt="" width="912" height="326" /></div>
<div></div>
<h2>Syntax</h2>
<p>You can call the script like this:</p>
<blockquote><p>Enable-RemotePowerShellForVM.ps1 &#8220;<strong>X:\mycredentials.publishsettings</strong>&#8221; &#8220;<strong>Name Of My Subscription</strong>&#8221; &#8220;<strong>Name of my Cloud Service</strong>&#8221; &#8220;<strong>Name of my VM</strong>&#8220;</p></blockquote>
<p>Now this means that, after installing your Virtual Machine with Remote PowerShell enabled, you only need to run one line of code on  your machine to setup Remote PowerShell on your local machine. After that you can start doing things like deploy an application, install SharePoint, a TFS Build Server, &#8230;</p>
<p><img class="alignnone size-large wp-image-761" title="Step2-TestScript" src="http://fabriccontroller.net/wp-content/uploads/Step2-TestScript-1024x311.png" alt="" width="1024" height="311" /></p>
<h2>Source</h2>
<p>One of the reasons why I created this script was to test out a nice PowerShell feature that allows you to create types (which you can use in PowerShell) by using C# code. I actually wrote this script in a Console Application and then just copied the code to a .ps1 file. Finally, by calling Add-Type we turn the C# code into a type which can then be used in PowerShell. Call me lazy, but it&#8217;s so much easier to do C# in PowerShell <img src='http://fabriccontroller.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<script src="http://gist.github.com/2a30f219793c8fa9c785.js"></script>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://fabriccontroller.net/blog/posts/automatically-configuring-remote-powershell-for-windows-azure-virtual-machines-on-your-machine/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using Remote Powershell with Windows Azure Virtual Machines</title>
		<link>http://fabriccontroller.net/blog/posts/using-remote-powershell-with-windows-azure-virtual-machines/</link>
		<comments>http://fabriccontroller.net/blog/posts/using-remote-powershell-with-windows-azure-virtual-machines/#comments</comments>
		<pubDate>Mon, 29 Apr 2013 01:44:33 +0000</pubDate>
		<dc:creator>sandrinodimattia</dc:creator>
				<category><![CDATA[Windows Azure Virtual Machines]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Virtual Machines]]></category>

		<guid isPermaLink="false">http://fabriccontroller.net/?p=739</guid>
		<description><![CDATA[Update: I created a script which makes this a lot easier, you can find it in my next blog post (Script to automatically configuring Remote PowerShell for Windows Azure Virtual Machines on your machine). Just before the weekend Scott Guthrie announced a few improvements to Virtual Networks, Virtual Machines and Cloud Services. One of these improvements [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p><strong>Update:</strong> I created a script which makes this a lot easier, you can find it in my next blog post (<a title="Script to automatically configuring Remote PowerShell for Windows Azure Virtual Machines on your machine" href="http://fabriccontroller.net/blog/posts/automatically-configuring-remote-powershell-for-windows-azure-virtual-machines-on-your-machine/">Script to automatically configuring Remote PowerShell for Windows Azure Virtual Machines on your machine</a>).</p></blockquote>
<p>Just before the weekend Scott Guthrie <a href="http://weblogs.asp.net/scottgu/archive/2013/04/26/windows-azure-improvements-to-virtual-networks-virtual-machines-cloud-services-and-a-new-ruby-sdk.aspx">announced</a> a few improvements to Virtual Networks, Virtual Machines and Cloud Services. One of these improvements was the support for Remote Powershell. This means that, when you create a Virtual Machine you can choose to enable Remote Powershell on that machine.</p>
<p>You can enable Remote Powershell by simply checking the box after creating your Virtual Machine (not that this option only shows if you&#8217;re creating the Virtual Machine from the gallery):</p>
<p><img class="alignnone  wp-image-740" title="Step1-EnablePowershellRemoting" src="http://fabriccontroller.net/wp-content/uploads/Step1-EnablePowershellRemoting.png" alt="" width="638" height="462" /></p>
<p>After the machine has been created go to the Endpoints tab. There you&#8217;ll see which port maps to the remote Powershell port. In my case this is port 54355:</p>
<p><img class="alignnone size-full wp-image-741" title="Step2-Endpoint" src="http://fabriccontroller.net/wp-content/uploads/Step2-Endpoint.png" alt="" width="724" height="241" /></p>
<p>Now simply start a new Powershell console on your machine and use the <strong>Enter-PSSession </strong>command (replace the hostname, the port and the username):</p>
<blockquote><p>Enter-PSSession -ComputerName <strong>mymachine</strong>.cloudapp.net -Port <strong>54355</strong> -Credential <strong>sandrino</strong> -UseSSL</p></blockquote>
<p>Now when you try to connect you will see the following error:</p>
<blockquote class="error"><p>Enter-PSSession : Connecting to remote server myserver.cloudapp.net failed with the following error message : The server certificate on the destination computer (myserver.cloudapp.net:54355) has the following errors: The SSL certificate is signed by an unknown certificate authority. For more information, see the about_Remote_Troubleshooting Help topic.</p></blockquote>
<p>This is because Remote Powershell uses HTTPS and the certificate used for your Virtual Machine is a self signed certificate. To solve this open your browser and navigate to your VM and the public endpoint for Remote Powershell. In my case this would be:</p>
<p><a href="https://mymachine.cloudapp.net:54355">https://mymachine.cloudapp.net:54355</a></p>
<p>Now since I didn&#8217;t find the certificate button in IE10 (sometimes it shows, sometimes it doesn&#8217;t) I used Chrome to get the certificate by clicking the little lock and then clicking the <strong>Certificate information</strong> link:</p>
<p><img class="alignnone size-full wp-image-745" title="Step1-CertificateInfo" src="http://fabriccontroller.net/wp-content/uploads/Step1-CertificateInfo.png" alt="" width="453" height="240" /></p>
<p>This will open the certificate. Go to the <strong>Details </strong>tab and choose <strong>Copy to File</strong> to save the file to disk. After that you&#8217;ll need to open the certificate and choose to install it under <strong>Current User &gt; Trusted Root Certification Authorities</strong>. Press Yes to continue and you&#8217;re done.</p>
<p>After that simply reexecute the <strong>Enter-PSSession</strong> command and you&#8217;ll be prompted for the password. Enter your password and you&#8217;ll be connected to your VM using Remote Powershell:</p>
<p><img class="alignnone size-full wp-image-747" title="Step3-RemotePSTest" src="http://fabriccontroller.net/wp-content/uploads/Step3-RemotePSTest.png" alt="" width="877" height="491" /></p>
<p>And if you&#8217;re done, just type <strong>exit</strong> to leave the session.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://fabriccontroller.net/blog/posts/using-remote-powershell-with-windows-azure-virtual-machines/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Setting up software based Site-to-Site VPN for Windows Azure with Windows Server 2012 Routing and Remote Access</title>
		<link>http://fabriccontroller.net/blog/posts/setting-up-software-based-site-to-site-vpn-for-windows-azure-with-windows-server-2012-routing-and-remote-access/</link>
		<comments>http://fabriccontroller.net/blog/posts/setting-up-software-based-site-to-site-vpn-for-windows-azure-with-windows-server-2012-routing-and-remote-access/#comments</comments>
		<pubDate>Mon, 29 Apr 2013 01:01:29 +0000</pubDate>
		<dc:creator>sandrinodimattia</dc:creator>
				<category><![CDATA[Windows Azure Virtual Networks]]></category>
		<category><![CDATA[Routing and Remote Access]]></category>
		<category><![CDATA[Virtual Networks]]></category>
		<category><![CDATA[Windows Server 2012]]></category>

		<guid isPermaLink="false">http://fabriccontroller.net/?p=707</guid>
		<description><![CDATA[A follow-up post is available with a complete reference implementation: Reference implementation: Creating a hybrid cloud with Windows Azure Virtual Networks software based Site-to-Site VPN Two days ago, only one week after Virtual Machines and Virtual Networks reached general availability, Scott Guthrie already announced a few new improvements to Virtual Machines and Virtual Networks. One of the big [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>A follow-up post is available with a complete reference implementation: <a href="http://fabriccontroller.net/blog/posts/reference-implementation-for-windows-azure-virtual-networks-software-based-site-to-site-vpn/">Reference implementation: Creating a hybrid cloud with Windows Azure Virtual Networks software based Site-to-Site VPN</a></p></blockquote>
<p>Two days ago, only one week after Virtual Machines and Virtual Networks reached general availability, Scott Guthrie already announced a few new improvements to Virtual Machines and Virtual Networks. One of the big changes for Virtual Networks is the support for software based Site-to-Site VPN based on the Routing and Remote Access role available in Windows Server 2012.</p>
<p>Let&#8217;s take a look at how easy it is to setup a Site-to-Site VPN with RRAS based on a customer case. Contoso is a company with a datacenter in Belgium (Brussels). For a marketing campaign the created a new application and because they needed a quick time-to-marked they decided to deploy it on a few Windows Azure Virtual Machines in the Western Europe datacenter. These machines connect to some of their systems like the intranet, their Oracle database, &#8230; For security reasons they didn&#8217;t want to make these systems available through the internet, so that&#8217;s why they decided to setup a Site-to-Site VPN between their on-premises network (the datacenter in Brussels) and the Virtual Machines running in Windows Azure.</p>
<h2>Works on my machine!</h2>
<p>Before we start we&#8217;ll need to see if our network matches the requirements:</p>
<ul>
<li>Windows Server 2012</li>
<li>The server is not behind a NAT (<a href="http://msdn.microsoft.com/en-us/library/windowsazure/dn133795.aspx">http://msdn.microsoft.com/en-us/library/windowsazure/dn133795.aspx</a>)</li>
<li>We opened the required ports for IKEv2 on the server: (<a href="http://blogs.technet.com/b/rrasblog/archive/2006/06/14/which-ports-to-unblock-for-vpn-traffic-to-pass-through.aspx">http://blogs.technet.com/b/rrasblog/archive/2006/06/14/which-ports-to-unblock-for-vpn-traffic-to-pass-through.aspx</a>)
<ul>
<li>IP Protocol Type=UDP, UDP Port Number=500 &lt;- Used by IKEv2 (IPSec control path)</li>
<li>IP Protocol Type=UDP, UDP Port Number=4500 &lt;- Used by IKEv2 (IPSec control path)</li>
<li>IP Protocol Type=UDP, UDP Port Number=1701 &lt;- Used by L2TP control/data path</li>
<li>IP Protocol Type=50 &lt;- Used by data path (ESP)
<ul>
<li><strong>This is not a port, it&#8217;s a protocol.</strong></li>
<li><strong>This one can be a show stopper if you&#8217;re using a residential line or a dedicated server somewhere.</strong></li>
</ul>
</li>
</ul>
</li>
</ul>
<h2>Defining the local network</h2>
<p>The first thing we need to do is define the local network (this would be our on-premises network). This can be done on the portal under the <strong>Networks</strong> option by clicking the <strong>New</strong> button:</p>
<p><img class="alignnone size-full wp-image-716" title="Step1-AddLocalNetwork" src="http://fabriccontroller.net/wp-content/uploads/Step1-AddLocalNetwork.png" alt="" width="529" height="296" /></p>
<p>After that simply define the name, the address space and the public IP of your server:</p>
<p><img class="alignnone size-full wp-image-718" title="Step2-LocalNetwork" src="http://fabriccontroller.net/wp-content/uploads/Step2-LocalNetwork1.png" alt="" width="780" height="158" /></p>
<h2>Creating the Virtual Network</h2>
<p>Now go ahead and create a new Virtual Network. On the second page you&#8217;ll need to enable the <strong>Configure Site-To-Site VPN</strong> option. This is where you get to choose the local network:</p>
<p><img class="alignnone size-full wp-image-719" title="Step3-ContosoVNET" src="http://fabriccontroller.net/wp-content/uploads/Step3-ContosoVNET.png" alt="" width="984" height="655" /></p>
<p>On the next page you&#8217;ll simply need to define a gateway subnet and you&#8217;ll be able to complete the wizard. After a few seconds the Virtual Network will have been created.</p>
<h2>Setting up the gateway</h2>
<p>After the Virtual Network has been created you&#8217;ll need to setup the gateway. At the moment static routing is not supported for RRAS so you&#8217;ll need to create a gateway with dynamic routing (<a href="http://msdn.microsoft.com/en-us/library/windowsazure/jj156075.aspx">http://msdn.microsoft.com/en-us/library/windowsazure/jj156075.aspx</a>):</p>
<p><img class="alignnone size-full wp-image-720" title="Step4-Gateway" src="http://fabriccontroller.net/wp-content/uploads/Step4-Gateway.png" alt="" width="273" height="169" /></p>
<p>And now  you&#8217;ll need to wait a few <strong>minutes</strong>. Once you&#8217;re done waiting you can download the VPN Device Script.</p>
<p><img class="alignnone size-full wp-image-726" title="Step4-DownloadScript" src="http://fabriccontroller.net/wp-content/uploads/Step4-DownloadScript.png" alt="" width="373" height="356" /></p>
<h2>VPN Device Script</h2>
<p>When you click the <strong>Download VPN Device Script</strong> link you&#8217;ll see the following dialog:</p>
<p><img class="alignnone size-full wp-image-725" title="Step4-RRAS" src="http://fabriccontroller.net/wp-content/uploads/Step4-RRAS.png" alt="" width="528" height="495" /></p>
<p>This is where you&#8217;ll get to choose RRAS. After downloading the script you might need to fix a small issue. When I downloaded the script (I tried several times) it looked like something was wrong with the file. Take a look at it:</p>
<p><img class="alignnone size-full wp-image-727" title="Step5-ReplaceScript" src="http://fabriccontroller.net/wp-content/uploads/Step5-ReplaceScript.png" alt="" width="527" height="148" /></p>
<p>It looks like double quotes have been replaced with a little square. Maybe an encoding issue? Just replace them with double quotes with any text editor (I&#8217;m using Notepad++) and you&#8217;re ready to continue. Now you&#8217;ll need to modify a few variables:</p>
<ol>
<li>Line 75: Replace <strong>&lt;SP_AzureGatewayIpAddress&gt;</strong> with the IP address of your gateway (the big IP address you&#8217;ll find on the portal)</li>
<li>Line 75: Replace <strong>&lt;SP_AzureNetworkCIDR&gt;</strong> with the network CIDR you defined when creating the new Virtual Network (in my case this was 10.1.2.0/24)</li>
<li>Line 75: Replace <strong>&lt;SP_AzureNetworkMetric&gt; </strong>with your network metric (I used 10)</li>
<li>Line 78: Replace <strong>&lt;SP_AzureGatewayIpAddress&gt;</strong> with the IP address of your gateway (the big IP address you&#8217;ll find on the portal)</li>
<li>Line 79: Replace <strong>&lt;SP_AzureGatewayIpAddress&gt;</strong> with the IP address of your gateway (the big IP address you&#8217;ll find on the portal)</li>
<li>Line 85: Replace <strong>&lt;SP_AzureGatewayIpAddress&gt;</strong> with the IP address of your gateway (the big IP address you&#8217;ll find on the portal)</li>
</ol>
<p>Finally save the file as a *.ps1 file and execute it on your server. This will install (if not present) RRAS and configure the site to site VPN:</p>
<p><img class="alignnone size-full wp-image-728" title="Step6-PS" src="http://fabriccontroller.net/wp-content/uploads/Step6-PS.png" alt="" width="876" height="271" /></p>
<p>Now the error you see here isn&#8217;t a real issue. It looks like the server wasn&#8217;t ready configuring RRAS when we executed the script. Wait a few seconds and open RRAS to see the result (the interface should have connected by now):</p>
<p><img class="alignnone size-full wp-image-730" title="Step6-Connected" src="http://fabriccontroller.net/wp-content/uploads/Step6-Connected.png" alt="" width="981" height="188" /></p>
<h2>Connecting both Sites</h2>
<p>You&#8217;re done! Go back to the portal, open the Virtual Network and press the <strong>Connect</strong> button. After a few seconds the Site-to-Site VPN between your on-premises network and your Virtual Network will be running:</p>
<p><img class="alignnone size-full wp-image-732" title="Step7-Connected" src="http://fabriccontroller.net/wp-content/uploads/Step7-Connected1.png" alt="" width="909" height="664" /></p>
<p>And the link is working! Now you can go ahead and configure whatever needs to be configured in RRAS (routing to specific parts of your network for example).</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://fabriccontroller.net/blog/posts/setting-up-software-based-site-to-site-vpn-for-windows-azure-with-windows-server-2012-routing-and-remote-access/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>&#8220;Key not valid for use in specified state&#8221; exception when working with the Access Control Service</title>
		<link>http://fabriccontroller.net/blog/posts/key-not-valid-for-use-in-specified-state-exception-when-working-with-the-access-control-service/</link>
		<comments>http://fabriccontroller.net/blog/posts/key-not-valid-for-use-in-specified-state-exception-when-working-with-the-access-control-service/#comments</comments>
		<pubDate>Sun, 27 Jan 2013 21:03:35 +0000</pubDate>
		<dc:creator>sandrinodimattia</dc:creator>
				<category><![CDATA[Windows Azure AppFabric]]></category>
		<category><![CDATA[.NET 4.5]]></category>
		<category><![CDATA[Access Control Service]]></category>
		<category><![CDATA[System.IdentityModel]]></category>

		<guid isPermaLink="false">http://fabriccontroller.net/?p=689</guid>
		<description><![CDATA[If you&#8217;re using the Windows Azure Access Control Service (or any other STS for that matter) this is an issue you might encounter when your Web Role has more than one instance: [CryptographicException: Key not valid for use in specified state.] System.Security.Cryptography.ProtectedData.Unprotect(Byte[] encryptedData, Byte[] optionalEntropy, DataProtectionScope scope) +450 Microsoft.IdentityModel.Web.ProtectedDataCookieTransform.Decode(Byte[] encoded) +150 As explained in the [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re using the Windows Azure Access Control Service (or any other STS for that matter) this is an issue you might encounter when your Web Role has more than one instance:</p>
<blockquote class="error"><p>[CryptographicException: Key not valid for use in specified state.]<br />
System.Security.Cryptography.ProtectedData.Unprotect(Byte[] encryptedData, Byte[] optionalEntropy, DataProtectionScope scope) +450<br />
Microsoft.IdentityModel.Web.ProtectedDataCookieTransform.Decode(Byte[] encoded) +150</p></blockquote>
<p>As <a href="http://msdn.microsoft.com/en-us/identitytrainingcourse_wifonwazlab2010_topic2.aspx">explained</a> in the Windows Azure Training Kit this is caused by the DPAPI:</p>
<blockquote><p><strong>What does ServiceConfigurationCreated do?</strong><br />
By default WIF SessionTokens use DPAPI to protect the content of Cookies that it sends to the client, however DPAPI is not available in Windows Azure hence you must use an alternative mechanism. In this case, we rely on RsaEncryptionCookieTransform, which we use for encrypting the cookies with the same certificate we are using for SSL in our website.</p></blockquote>
<p>Over a year ago <a href="http://fabriccontroller.net/blog/posts/a-few-tips-to-get-up-and-running-with-the-azure-appfabric-access-control-service/">I blogged</a> about this issue but that solution applies to .NET 3.5/4.0 with Visual Studio 2010. Let&#8217;s take a look at how you can solve this issue when you&#8217;re working in .NET 4.5.</p>
<h2>Creating a certificate</h2>
<p>So the the first thing you&#8217;ll need to do is create a certificate and upload it to your Cloud Service. The easiest way to do this is to start IIS locally and go to the Server Certificates:</p>
<p><img class="alignnone size-full wp-image-694" title="Step1-Certificates" src="http://fabriccontroller.net/wp-content/uploads/Step1-Certificates.png" alt="" width="799" height="480" /></p>
<p>Now click the <strong>Create Self-Signed Certificate</strong> option, fill in the name, press OK, right click the new certificate and choose &#8220;<strong>Export&#8230;</strong>&#8220;. The next you&#8217;ll need to do is go to the Windows Azure Portal and upload the certificate in the Cloud Service. This is possible by opening the Cloud Service and uploading the file in the Certificates tab:</p>
<p><img class="alignnone size-large wp-image-695" title="Step3-Certificates" src="http://fabriccontroller.net/wp-content/uploads/Step3-Certificates-1024x259.png" alt="" width="1024" height="259" /></p>
<p>Copy the thumbprint and add it to the certificates of your Web Role. This is possible by double clicking the Web Role in Visual Studio and going to the Certificates tab:</p>
<p><img class="alignnone size-full wp-image-696" title="Step4-Solution" src="http://fabriccontroller.net/wp-content/uploads/Step4-Solution.png" alt="" width="1012" height="180" /></p>
<p>As a result the certificate will be installed on all instances of that Web Role. Finally open the web.config of your web application and add a reference to the certificate under the <strong>system.identityModel.services</strong> element:</p>
<script src="http://gist.github.com/de6f4e96c0d046823f94.js"></script>
<h2>Creating the  SessionSecurityTokenHandler</h2>
<p>The last thing we need to do is create a SessionSecurityTokenHandler which uses the certificate. To get started add a reference to the following assemblies:</p>
<ul>
<li>System.IdentityModel</li>
<li>System.IdentityModel.Services</li>
</ul>
<p>Once you added the required references you can add the following code to your <strong>Global.asax</strong> file:</p>
<script src="http://gist.github.com/95529e9634ae2c5125a2.js"></script>
<p>This code replaces the current security token handler with a new <strong>SessionSecurityTokenHandler</strong> which uses the certificate we uploaded to the portal. As of now, all instances will use the same certificate to encrypt and decrypt the authentication session cookie.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://fabriccontroller.net/blog/posts/key-not-valid-for-use-in-specified-state-exception-when-working-with-the-access-control-service/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Browse and use images from the VM Depot in the Windows Azure Portal</title>
		<link>http://fabriccontroller.net/blog/posts/browse-and-use-images-from-the-vm-depot/</link>
		<comments>http://fabriccontroller.net/blog/posts/browse-and-use-images-from-the-vm-depot/#comments</comments>
		<pubDate>Thu, 24 Jan 2013 10:35:20 +0000</pubDate>
		<dc:creator>sandrinodimattia</dc:creator>
				<category><![CDATA[Windows Azure Virtual Machines]]></category>
		<category><![CDATA[Solr]]></category>
		<category><![CDATA[VM Depot]]></category>
		<category><![CDATA[Windows Azure Portal]]></category>

		<guid isPermaLink="false">http://fabriccontroller.net/?p=672</guid>
		<description><![CDATA[A few weeks ago Microsoft announced the release of the VM Depot, a community-driven catalog of VM Images. Deploying a Virtual Machine with an image from the VM Depot was pretty easy: Download/Upload the VM image yourself. Use the azure-cli to do all the work But it looks like the VM Depot now seamlessly integrates with the Windows [...]]]></description>
			<content:encoded><![CDATA[<p>A few weeks ago Microsoft announced the release of the <a href="http://vmdepot.msopentech.com/List/Index">VM Depot</a>, a community-driven catalog of VM Images. Deploying a Virtual Machine with an image from the VM Depot was pretty easy:</p>
<ul>
<li>Download/Upload the VM image yourself.</li>
<li>Use the <a href="http://blogs.msdn.com/b/silverlining/archive/2013/01/10/using-the-vm-depot.aspx">azure-cli</a> to do all the work</li>
</ul>
<p>But it looks like the VM Depot now seamlessly integrates with the Windows Azure Portal. Let&#8217;s take a look at how easy it is to create Virtual Machines based on VM Depot images from within the portal.</p>
<h2>Create the image</h2>
<p>If you browse to Virtual Machines in the portal you&#8217;ll see the new <strong>Browse VM Depot</strong> option under the <strong>Images</strong> tab:</p>
<p><img class="alignnone size-large wp-image-674" title="Step1-Create" src="http://fabriccontroller.net/wp-content/uploads/Step1-Create-1024x689.png" alt="" width="1024" height="689" /></p>
<p>Next you&#8217;ll be able to browse the images available in the VM Depot:</p>
<p><img class="alignnone size-full wp-image-676" title="Step2-Browse" src="http://fabriccontroller.net/wp-content/uploads/Step2-Browse.png" alt="" width="845" height="653" /></p>
<p>After selecting an image you will need to choose in which storage account it will be dropped:</p>
<p><img class="alignnone size-full wp-image-677" title="Step3-Solr" src="http://fabriccontroller.net/wp-content/uploads/Step3-Solr.png" alt="" width="842" height="658" /></p>
<p>Wait a few seconds for the copy to complete. Once it&#8217;s done you&#8217;ll see that the image appears in the <strong>Images</strong> tab with a <strong>Pending registration</strong> status:</p>
<p><img class="alignnone size-full wp-image-678" title="Step4-Pending" src="http://fabriccontroller.net/wp-content/uploads/Step4-Pending.png" alt="" width="787" height="377" /></p>
<p>Click the <strong>Register</strong> button to register the image which will change the status to <strong>Available</strong>.</p>
<p><img class="alignnone size-full wp-image-684" title="Step5-Register" src="http://fabriccontroller.net/wp-content/uploads/Step5-Register.png" alt="" width="520" height="365" /></p>
<h2>Creating the Virtual Machine</h2>
<p>That was the &#8220;hard&#8221; part. Now in order to create the Virtual Machine you&#8217;ll need to go to the <strong>Virtual Machine Instances</strong> tab and choose <strong>Create a Virtual Machine</strong>. Choose to create it from the <strong>Gallery</strong>. In the Gallery you&#8217;ll see the <strong>My Images</strong> tab and this is where you&#8217;ll find the image:</p>
<p><img class="alignnone size-full wp-image-679" title="Step6-CreateVM" src="http://fabriccontroller.net/wp-content/uploads/Step6-CreateVM.png" alt="" width="931" height="467" /></p>
<p>Select this image and go through the wizard (enter the name of the machine, username, password, &#8230;). The provisioning process will start and after a few minutes the VM will be ready. This means you&#8217;ll be able to connect to the VM through SSH (<strong>myvmname.cloudapp.net port 22</strong>):</p>
<p><img class="alignnone size-full wp-image-680" title="Step7-Puttyu" src="http://fabriccontroller.net/wp-content/uploads/Step7-Puttyu.png" alt="" width="675" height="425" /></p>
<p>If you want to connect to the Solr dashboard you can also add an endpoint for port 80:</p>
<p><img class="alignnone size-full wp-image-681" title="Step8-Endpoints" src="http://fabriccontroller.net/wp-content/uploads/Step8-Endpoints.png" alt="" width="927" height="204" /></p>
<p>And here is the dashboard:</p>
<p><img class="alignnone size-large wp-image-682" title="Step9-Admin" src="http://fabriccontroller.net/wp-content/uploads/Step9-Admin-1024x658.png" alt="" width="1024" height="658" /></p>
<p>This is really great. In just a few minutes I&#8217;ve set up a fully functional Solr deployment, which I can use in my applications to offer an improved search experience. If you want to use this in production I suggest you also look at <a href="http://www.windowsazure.com/en-us/home/features/networking/">Virtual Networks</a>. This feature allows you to connect the VM to your applications (running in Cloud Services/Virtual Machines or even on-premises) without having to expose it to the internet.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://fabriccontroller.net/blog/posts/browse-and-use-images-from-the-vm-depot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Improve performance of your Node.js Web Site with Windows Azure Caching (Dedicated Role)</title>
		<link>http://fabriccontroller.net/blog/posts/improve-performance-of-your-node-js-web-site-with-windows-azure-caching-dedicated-role/</link>
		<comments>http://fabriccontroller.net/blog/posts/improve-performance-of-your-node-js-web-site-with-windows-azure-caching-dedicated-role/#comments</comments>
		<pubDate>Wed, 23 Jan 2013 00:16:27 +0000</pubDate>
		<dc:creator>sandrinodimattia</dc:creator>
				<category><![CDATA[Windows Azure Web Sites]]></category>
		<category><![CDATA[memcache]]></category>
		<category><![CDATA[Node.js]]></category>
		<category><![CDATA[Windows Azure Caching]]></category>

		<guid isPermaLink="false">http://fabriccontroller.net/?p=631</guid>
		<description><![CDATA[If your application is running in a Cloud Service (Web/Worker Role) it&#8217;s very easy add caching to your application by using Windows Azure Caching: Windows Azure Caching introduces a new way to perform caching by using a portion of the memory of the virtual machines that host the role instances in your Windows Azure cloud [...]]]></description>
			<content:encoded><![CDATA[<p>If your application is running in a Cloud Service (Web/Worker Role) it&#8217;s very easy add caching to your application by using <a href="http://www.windowsazure.com/en-us/develop/net/how-to-guides/cache/">Windows Azure Caching</a>:</p>
<blockquote><p>Windows Azure Caching introduces a new way to perform caching by using a portion of the memory of the virtual machines that host the role instances in your Windows Azure cloud services (also known as hosted services). You have greater flexibility in terms of deployment options, the caches can be very large in size and have no cache specific quota restrictions.</p></blockquote>
<p>The .NET libraries depend on a library which is specific to Cloud Services, which makes them unable to use in Windows Azure Web Sites. This restriction applies to the official Windows Azure Caching libraries for .NET. But Windows Azure Caching also <a href="http://msdn.microsoft.com/en-us/library/windowsazure/hh914167.aspx">supports the memcache protocol</a>, this means you can use it from any environment supporting memcache like Node.js, php, &#8230;</p>
<p>Let&#8217;s see how we can configure the memcache protocol in Windows Azure Caching, open it up for Windows Azure Web Sites and call it from a Node.js application.</p>
<h2>Memcache support for Windows Azure Caching</h2>
<p>We start by creating a new Dedicated Cache Worker Role as described <a href="http://www.windowsazure.com/en-us/develop/net/how-to-guides/cache/">here</a>. Once this is done we&#8217;ll add support for the memcache protocol by using the Memcache Server Gateway.  The Client Shim is not an option here since it requires an installation on the consumer side: in our case this is the Web Site and Web Sites don&#8217;t support running custom installations at the moment (remember that you&#8217;re running in a shared hosting model).</p>
<p>Setting up the Memcache Server Gateway is pretty easy: add an endpoint called <strong>memcache_default </strong>to your Cache Worker Role (you can choose the port):</p>
<p><img class="alignnone size-full wp-image-646" title="Step3-Endpoint" src="http://fabriccontroller.net/wp-content/uploads/Step3-Endpoint.png" alt="" width="890" height="196" /></p>
<h2>Allowing access from your Web Site</h2>
<p>When using Windows Azure Caching within a Cloud Service you typically set the endpoint type to <strong>Internal</strong>. But since the Web Site is not part of the Cloud Service you&#8217;ll need to change the endpoint to <strong>Input</strong>. It&#8217;s important to know that, by changing the type to Input, your Web Site will be able to connect to the endpoint just like everyone else with an internet connection.</p>
<p>Chances are pretty small that anyone will find this endpoint (by guessing/scanning the IP+port), connect to it, find out that it can be used by a memcache client and do something with the data. But it&#8217;s better to be safe than sorry so here is what you can do: you can use the <a href="http://fabriccontroller.net/blog/posts/apply-ip-address-restrictions-to-your-windows-azure-cloud-services/">WindowsAzure.IPAddressRestriction library</a> to restrict access to the Worker Role. If you look at the <a href="https://github.com/sandrinodimattia/WindowsAzure-IPAddressRestriction/tree/master/Examples/">Examples on GitHub</a> there&#8217;s an example that shows you how to restrict access to your Worker Role endpoint(s) based on hostnames:</p>
<script src="http://gist.github.com/f683f5896afeed76979a.js"></script>
<p>Once you&#8217;ve set up this code in your Worker Role you can configure the hostnames in your Service Configuration:</p>
<script src="http://gist.github.com/49ea10a13d2b878d0163.js"></script>
<h2>Using Windows Azure Caching from your Node.js Web Site</h2>
<p>So we&#8217;ve set up Windows Azure Caching, added memcache support and made sure that (only) our Web Site can access the cache. Let&#8217;s get started on our Node.js application. The application will use the <a href="https://github.com/elbart/node-memcache">node-memcache</a> library to access Windows Azure Caching through the memcache protocol. Here is the sample application:</p>
<script src="http://gist.github.com/c1d2bcdd5f1b33572207.js"></script>
<p>The code is pretty straight forward. We reference the library, create the client and connect to the endpoint we opened in the Cloud Service. The <strong>get</strong> and <strong>set</strong> methods allow you interact with the cache. If you access the page the first time you&#8217;ll see that the value is added to the cache:</p>
<p><img class="alignnone size-full wp-image-669" title="Step1-SetValue" src="http://fabriccontroller.net/wp-content/uploads/Step1-SetValue.png" alt="" width="725" height="267" /></p>
<p>Each subsequent request will get the data from the cache:</p>
<p><img class="alignnone size-full wp-image-670" title="Step2-GetValue" src="http://fabriccontroller.net/wp-content/uploads/Step2-GetValue.png" alt="" width="725" height="267" /></p>
<p>And that&#8217;s about it. You&#8217;re all set up to use Windows Azure Caching through the memcache protocol which can drastically improve performance of your site.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://fabriccontroller.net/blog/posts/improve-performance-of-your-node-js-web-site-with-windows-azure-caching-dedicated-role/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
