<?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>t h e D a v i d A i k e n</title>
	<atom:link href="http://www.davidaiken.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.davidaiken.com</link>
	<description>Not Statistically Significant</description>
	<lastBuildDate>Wed, 30 Jan 2013 04:58:43 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Blah, Blah, Blah, Blah De Blah, and I&#8217;m back in the room!</title>
		<link>http://www.davidaiken.com/2013/01/29/blah-blah-blah-blah-de-blah-and-im-back-in-the-room/</link>
		<comments>http://www.davidaiken.com/2013/01/29/blah-blah-blah-blah-de-blah-and-im-back-in-the-room/#comments</comments>
		<pubDate>Wed, 30 Jan 2013 04:26:39 +0000</pubDate>
		<dc:creator>theDavidAiken</dc:creator>
				<category><![CDATA[Ramble]]></category>
		<category><![CDATA[Thinking Out Loud]]></category>

		<guid isPermaLink="false">http://www.davidaiken.com/?p=249</guid>
		<description><![CDATA[WARNING: This post has no clear value except to start me blogging again. It has been a while since I last posted. Since my last post, I&#8217;ve worked on some of the biggest Windows Azure projects, had 2 vacations, spoken at several conferences, changed jobs TWICE, moved office, moved house, made a doll&#8217;s bed &#38; <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://www.davidaiken.com/2013/01/29/blah-blah-blah-blah-de-blah-and-im-back-in-the-room/" class="more-link"><span>Read More &#8594;</span></a></span>]]></description>
				<content:encoded><![CDATA[
<p>WARNING: This post has no clear value except to start me blogging again.</p>
<p>It has been a while since I last posted.</p>
<p>Since my last post, I&#8217;ve worked on some of the biggest Windows Azure projects, had 2 vacations, spoken at several conferences, changed jobs TWICE, moved office, moved house, made a doll&#8217;s bed &amp; changed cars.</p>
<p>Looking back it was a very good year, but it was also an extremely busy year. There were many things I didn&#8217;t get to do as much as I wanted too. Cycling and blogging being 2 of the main ones.</p>
<ol>
<li>Cycling &#8211; because riding 18 miles each day actually counts as exercise and its a great way to de-stress and think.</li>
<li>Blogging &#8211; because I find it incredibly useful to organize my thoughts into words. It also serves as a reference for when I forget things.</li>
</ol>
<p>So the goal is to start doing these 2 things again. Wish me luck!</p>
<p>&nbsp;</p>

]]></content:encoded>
			<wfw:commentRss>http://www.davidaiken.com/2013/01/29/blah-blah-blah-blah-de-blah-and-im-back-in-the-room/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to use Diagnostics.wadcfg to configure Windows Azure diagnostics collection</title>
		<link>http://www.davidaiken.com/2012/02/27/how-to-use-diagnostics-wadcfg-to-configure-windows-azure-diagnostics-collection/</link>
		<comments>http://www.davidaiken.com/2012/02/27/how-to-use-diagnostics-wadcfg-to-configure-windows-azure-diagnostics-collection/#comments</comments>
		<pubDate>Mon, 27 Feb 2012 12:32:00 +0000</pubDate>
		<dc:creator>theDavidAiken</dc:creator>
				<category><![CDATA[Windows Azure]]></category>
		<category><![CDATA[Diagnostics]]></category>

		<guid isPermaLink="false">http://www.davidaiken.com/?p=238</guid>
		<description><![CDATA[When a role imports the Diagnostics module by using the service definition, the Diagnostics module looks for a file named “diagnostics.wadcfg” in the root directory of the role. This file can be deployed in the same place as your app.config/web.config file. The file is used by the diagnostics agent to create the initial profile for <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://www.davidaiken.com/2012/02/27/how-to-use-diagnostics-wadcfg-to-configure-windows-azure-diagnostics-collection/" class="more-link"><span>Read More &#8594;</span></a></span>]]></description>
				<content:encoded><![CDATA[
<p>When a role imports the Diagnostics module by using the service definition, the Diagnostics module looks for a file named “diagnostics.wadcfg” in the root directory of the role. This file can be deployed in the same place as your app.config/web.config file.</p>
<p>The file is used by the diagnostics agent to create the initial profile for collection. You can modify the settings after deployment using the PowerShell cmdlets I’ve talked about previously.</p>
<p>Here is a sample file. It should be pretty straight forward to understand. Note, times for seconds would be in the format PT30S, this representing 30 seconds.</p>
<pre class="csharpcode"><span class="kwrd">&lt;?</span><span class="html">xml</span> <span class="attr">version</span><span class="kwrd">="1.0"</span> <span class="attr">encoding</span><span class="kwrd">="utf-8"</span> ?<span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">DiagnosticMonitorConfiguration</span> <span class="attr">xmlns</span><span class="kwrd">="http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration"</span> <span class="attr">configurationChangePollInterval</span><span class="kwrd">="PT15M"</span> <span class="attr">overallQuotaInMB</span><span class="kwrd">="4096"</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">WindowsEventLog</span> <span class="attr">bufferQuotaInMB</span><span class="kwrd">="1024"</span> 
                   <span class="attr">scheduledTransferLogLevelFilter</span><span class="kwrd">="Verbose"</span> 
                   <span class="attr">scheduledTransferPeriod</span><span class="kwrd">="PT10M"</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">DataSource</span> <span class="attr">name</span><span class="kwrd">="Application!*"</span><span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">DataSource</span> <span class="attr">name</span><span class="kwrd">="System!*"</span><span class="kwrd">/&gt;</span>    
  <span class="kwrd">&lt;/</span><span class="html">WindowsEventLog</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">DiagnosticInfrastructureLogs</span> <span class="attr">bufferQuotaInMB</span><span class="kwrd">="1024"</span>
                                <span class="attr">scheduledTransferLogLevelFilter</span><span class="kwrd">="Verbose"</span>
                                <span class="attr">scheduledTransferPeriod</span><span class="kwrd">="PT10M"</span> <span class="kwrd">/&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">Logs</span> <span class="attr">bufferQuotaInMB</span><span class="kwrd">="1024"</span>
        <span class="attr">scheduledTransferLogLevelFilter</span><span class="kwrd">="Verbose"</span>
        <span class="attr">scheduledTransferPeriod</span><span class="kwrd">="PT10M"</span> <span class="kwrd">/&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">PerformanceCounters</span> <span class="attr">bufferQuotaInMB</span><span class="kwrd">="512"</span> <span class="attr">scheduledTransferPeriod</span><span class="kwrd">="PT10M"</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">PerformanceCounterConfiguration</span> <span class="attr">counterSpecifier</span><span class="kwrd">="\Memory\Available MBytes"</span> <span class="attr">sampleRate</span><span class="kwrd">="PT5M"</span><span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">PerformanceCounterConfiguration</span> <span class="attr">counterSpecifier</span><span class="kwrd">="\Processor(_Total)\% Processor Time"</span> <span class="attr">sampleRate</span><span class="kwrd">="PT5M"</span><span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">PerformanceCounterConfiguration</span> <span class="attr">counterSpecifier</span><span class="kwrd">="\Network Interface(*)\Bytes Sent/sec"</span> <span class="attr">sampleRate</span><span class="kwrd">="PT5M"</span><span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">PerformanceCounterConfiguration</span> <span class="attr">counterSpecifier</span><span class="kwrd">="\Network Interface(*)\Bytes Total/sec"</span> <span class="attr">sampleRate</span><span class="kwrd">="PT5M"</span><span class="kwrd">/&gt;</span>
  <span class="kwrd">&lt;/</span><span class="html">PerformanceCounters</span><span class="kwrd">&gt;</span>  
<span class="kwrd">&lt;/</span><span class="html">DiagnosticMonitorConfiguration</span><span class="kwrd">&gt;</span></pre>
<p align="left">All you really have to do is drop that file in the root directory of your role and you are done!</p>
<p align="left">The documentation <a href="http://msdn.microsoft.com/en-us/library/gg604918.aspx" target="_blank">here</a>, suggests that you would use code to configure diagnostics. If you have ever read any of my blog posts you probably know how I feel about that. (Note: for those that haven’t its just wrong to use code. Really ops should be supplying this file for production. You have an ops team right?)</p>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
</p>
<p>THIS POSTING IS PROVIDED “AS IS” WITH NO WARRANTIES, AND CONFERS NO RIGHTS, UNLESS MY BROTHER GAVE YOU THE SECRET CODE.</p>

]]></content:encoded>
			<wfw:commentRss>http://www.davidaiken.com/2012/02/27/how-to-use-diagnostics-wadcfg-to-configure-windows-azure-diagnostics-collection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Encrypting and Decrypting in Windows Azure</title>
		<link>http://www.davidaiken.com/2012/02/24/encrypting-and-decrypting-in-windows-azure/</link>
		<comments>http://www.davidaiken.com/2012/02/24/encrypting-and-decrypting-in-windows-azure/#comments</comments>
		<pubDate>Fri, 24 Feb 2012 14:27:32 +0000</pubDate>
		<dc:creator>theDavidAiken</dc:creator>
				<category><![CDATA[Windows Azure]]></category>
		<category><![CDATA[Encryption]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.davidaiken.com/?p=235</guid>
		<description><![CDATA[When deploying applications to Windows Azure, you probably will be dealing with encrypted connections strings, passwords and other such things. If you have ever used Remote Desktop, you will have noticed an encrypted password, along with a certificate that is used to encrypt the password. You can of course do the same with your secret <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://www.davidaiken.com/2012/02/24/encrypting-and-decrypting-in-windows-azure/" class="more-link"><span>Read More &#8594;</span></a></span>]]></description>
				<content:encoded><![CDATA[
<p>When deploying applications to Windows Azure, you probably will be dealing with encrypted connections strings, passwords and other such things. If you have ever used Remote Desktop, you will have noticed an encrypted password, along with a certificate that is used to encrypt the password. You can of course do the same with your secret things too. </p>
<p align="left">Doing this creates the need for a tool to encrypt such settings. There are a few posts out there that show how to decrypt the values in code (you can grab some from <a href="https://skydrive.live.com/?cid=2345f1dcf071e55b&amp;sc=documents&amp;id=2345F1DCF071E55B%21107" target="_blank">here</a>), you still need a way for operators to create these values in the first place. I thought a couple of PowerShell scripts should do the trick nicely.</p>
<p>You will need the thumbprint of a certificate in the CurrentUser\My store, which would be the same cert you deploy with you Azure deployment in order to decrypt.</p>
<p>The Encrypt function looks like:</p>
<pre class="csharpcode">Function Encrypt($stringToEncrypt, $thumb)
{
    $cert = get-item cert:\CurrentUser\My\$thumb
    [System.Reflection.Assembly]::LoadWithPartialName(<span class="str">"System.Security"</span>) | out-null
    $passbytes = [Text.Encoding]::UTF8.GetBytes($stringToEncrypt)
    $content = New-Object Security.Cryptography.Pkcs.ContentInfo -argumentList (,$passbytes)
    $env = New-Object Security.Cryptography.Pkcs.EnvelopedCms $content
    $env.Encrypt((new-object System.Security.Cryptography.Pkcs.CmsRecipient($cert)))

    [Convert]::Tobase64String($env.Encode())
}</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<p>The Decrypt function looks like:</p>
<pre class="csharpcode">Function Decrypt($EncryptedString, $thumb)
{    
    $cert = get-item cert:\CurrentUser\My\$thumb    
    [System.Reflection.Assembly]::LoadWithPartialName(<span class="str">"System.Security"</span>) | out-null
    $encodedBytes = [Convert]::Frombase64String($EncryptedString)
    $env = New-Object Security.Cryptography.Pkcs.EnvelopedCms
    $env.Decode($encodedBytes)
    $env.Decrypt($cert)
    $enc = New-Object System.Text.ASCIIEncoding
    
    $enc.GetString($env.ContentInfo.Content)    
}</pre>
<p>Usage is simple:</p>
<pre class="csharpcode">$pwd = Encrypt <span class="str">"TheDavidAiken"</span> <span class="str">"39836617C1A2BBAC6F90C0224C31B019854C6659"</span>
Decrypt $pwd <span class="str">"39836617C1A2BBAC6F90C0224C31B019854C6659"</span></pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<p>Enjoy.</p>
<p>THIS POSTING IS PROVIDED “AS IS” WITH NO WARRANTIES, AND CONFERS NO RIGHTS, UNLESS YOU HAVE A NOTE FROM MY MUM</p>

]]></content:encoded>
			<wfw:commentRss>http://www.davidaiken.com/2012/02/24/encrypting-and-decrypting-in-windows-azure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ten Basic Troubleshooting Tips for Windows Azure</title>
		<link>http://www.davidaiken.com/2011/11/15/ten-basic-troubleshooting-tips-for-windows-azure/</link>
		<comments>http://www.davidaiken.com/2011/11/15/ten-basic-troubleshooting-tips-for-windows-azure/#comments</comments>
		<pubDate>Tue, 15 Nov 2011 21:42:02 +0000</pubDate>
		<dc:creator>theDavidAiken</dc:creator>
				<category><![CDATA[Windows Azure]]></category>
		<category><![CDATA[Tip]]></category>

		<guid isPermaLink="false">http://www.davidaiken.com/2011/11/15/ten-basic-troubleshooting-tips-for-windows-azure/</guid>
		<description><![CDATA[The last few posts I’ve talked a LOT about configuring diagnostics. Much of that comes not because I love pretty graphs, but because I end up working with customers who are troubleshooting problems with applications running on Windows Azure. Here is MY list of recommendations to help things run a little smoother: Keep your diagnostics <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://www.davidaiken.com/2011/11/15/ten-basic-troubleshooting-tips-for-windows-azure/" class="more-link"><span>Read More &#8594;</span></a></span>]]></description>
				<content:encoded><![CDATA[
<p>The last few posts I’ve talked a LOT about configuring diagnostics. Much of that comes not because I love pretty graphs, but because I end up working with customers who are troubleshooting problems with applications running on Windows Azure.</p>
<p>Here is MY list of recommendations to help things run a little smoother:</p>
<ol>
<li>Keep your diagnostics account separate from your production account. This will help with performance of both production and diagnostics since they won’t be competing for the same storage account.</li>
<li>Make sure your storage account is in the same data center as your compute. I know. Just saying.</li>
<li>Make sure you collect the right set of performance counters AND check that you are actually collecting data. Make sure you are collecting the .Net 4.0 counters for ASP.NET where applicable.</li>
<li>Use either the .wadcfg or PowerShell scripts I’ve talked about <a href="http://www.davidaiken.com/2011/10/18/how-to-easily-enable-windows-azure-diagnostics-remotely/" target="_blank">here</a> to configure diagnostics. Hard coding it will overwrite any changes you make when an instance restarts.</li>
<li>Knowing and understanding your baseline workload is important. You should look at your performance on a regular basis, and over a period of time.</li>
<li>To troubleshoot, you can enable RDP and perform an upgrade of your service. You can then RDP into specific instances to troubleshoot.</li>
<li>When you are working with Microsoft’s product support, try not to delete old deployments. Once you do it makes finding a root cause more difficult. You can always VIP swap them out and leave them running while they troubleshoot.</li>
<li>Having more instances running means more people can look at the problem at the same time.</li>
<li>Check the status of the service at <a title="http://www.microsoft.com/windowsazure/support/status/servicedashboard.aspx" href="http://www.microsoft.com/windowsazure/support/status/servicedashboard.aspx">http://www.microsoft.com/windowsazure/support/status/servicedashboard.aspx</a></li>
<li>Invest in a diagnostics data viewing tool, such as <a href="http://www.cerebrata.com/Products/AzureDiagnosticsManager/" target="_blank">Cerebrata</a>, or grab a free trail of ManageAxis by following the rabbit hole from the <a href="http://channel9.msdn.com/Shows/Cloud+Cover/Episode-64-Adding-Push-Notifications-to-Windows-Phone-Apps" target="_blank">Cloud Cover Show</a>.</li>
</ol>
<p>&nbsp;</p>
<p>M5$A)4R!03U-424Y&#8217;($E3(%!23U9)1$5$(.*`G$%3($E3XH&#8221;=(%=)5$@@3D\@A5T%24D%.5$E%4RP@04Y$($-/3D9%4E,@3D\@4DE&#8217;2%13`</p>

]]></content:encoded>
			<wfw:commentRss>http://www.davidaiken.com/2011/11/15/ten-basic-troubleshooting-tips-for-windows-azure/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How To Clean up old Windows Azure diagnostics</title>
		<link>http://www.davidaiken.com/2011/10/26/how-to-clean-up-old-windows-azure-diagnostics/</link>
		<comments>http://www.davidaiken.com/2011/10/26/how-to-clean-up-old-windows-azure-diagnostics/#comments</comments>
		<pubDate>Wed, 26 Oct 2011 16:49:18 +0000</pubDate>
		<dc:creator>theDavidAiken</dc:creator>
				<category><![CDATA[Windows Azure]]></category>
		<category><![CDATA[Diagnostics]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.davidaiken.com/2011/10/26/how-to-clean-up-old-windows-azure-diagnostics/</guid>
		<description><![CDATA[Last week I blogged about how to easily enable Windows Azure diagnostics remotely using PowerShell. Because of this, and the simple fact you enabled diagnostics in the first place means that you now have a small collection of folders building up in the wad-* folders. Every time you deploy, you will see a new folder <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://www.davidaiken.com/2011/10/26/how-to-clean-up-old-windows-azure-diagnostics/" class="more-link"><span>Read More &#8594;</span></a></span>]]></description>
				<content:encoded><![CDATA[
<p>Last week I blogged about <a href="http://www.davidaiken.com/2011/10/18/how-to-easily-enable-windows-azure-diagnostics-remotely/" target="_blank">how to easily enable Windows Azure diagnostics remotely</a> using PowerShell. Because of this, and the simple fact you enabled diagnostics in the first place means that you now have a small collection of folders building up in the wad-* folders. Every time you deploy, you will see a new folder created for that deployment. In this post I’m going to show you how you can write a script to remove the old deployments.</p>
<h1>What the script will do</h1>
<p>The script will:</p>
<ol>
<li>Find out the current deployment id. </li>
<li>Connect to blob storage </li>
<li>List all of the blobs that don’t have the deployment id in the uri. </li>
<li>Delete those blobs. </li>
</ol>
<p><strong>Note</strong>: This assumes you have 1 storage account for each deployment. If you use the same storage account for diagnostics from multiple apps you need to change the script. Also Why?</p>
<h1>Setup</h1>
<p>This is the same as the previous post, so if you already have done this, you can skip to the next section.</p>
<p>First you need to make sure you have a <a href="http://www.davidaiken.com/2009/12/21/how-to-create-a-x509-certificate-for-the-windows-azure-management-api/">management certificate created and installed</a>. </p>
<p>Once you have that, you need to download the PowerShell cmdlets from <a href="http://wappowershell.codeplex.com/">codeplex</a>.</p>
<p>Next figure out what the thumbprint of your certificate is. You can see this in the Windows Azure management portal when you click your certificate. While you are there, make a note of your subscription Id, Storage Account Name and Key and the service name.</p>
<h1>Defining the service and storage variables</h1>
<p>We’ll start with the same variables used in the previous post:</p>
<pre class="csharpcode"><span class="rem"># TODO: Cert thumbprint of a certificate already installed into the Windows Azure Portal</span>
$thumb = <span class="str">&quot;ENTERTHUMBHERE&quot;</span>
$cert = get-item cert:\CurrentUser\My\$thumb
<span class="rem"># TODO: Subscription Id</span>
$subid = <span class="str">&quot;ENTERSUBIDHERE&quot;</span>
<span class="rem"># TODO: Storage Account Name</span>
$SAN = <span class="str">&quot;ENTERSTORAGEACCOUNTNAMEHERE&quot;</span>
<span class="rem"># TODO: Storage Account Key</span>
$SAK = <span class="str">&quot;ENTERSTORAGEACCOUNTKEYHERE&quot;</span>
<span class="rem"># TODO: Service Name</span>
$serviceName = <span class="str">&quot;ENTERSERVICENAMEHERE&quot;</span></pre>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<h1>Getting the current Deployment Id</h1>
<p>Next, we’ll grab the deployment id:</p>
<pre class="csharpcode">$did = (Get-Deployment -ServiceName $serviceName -Certificate $cert -SubscriptionId $subid -Slot Production).DeploymentId
write-host <span class="str">&quot;current deployment &quot;</span> + $did</pre>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<h1>Connecting to blob storage</h1>
<p>First thing you need to do is to make sure the assemblies for storage are loaded. You can do this using</p>
<pre class="csharpcode">add-type -Path <span class="str">'C:\Program Files\Windows Azure SDK\v1.5\ref\Microsoft.WindowsAzure.StorageClient.dll'</span></pre>
<p>To access storage, we will use the CloudBlobClient class from the storage client library. This requires some credentials:</p>
<pre class="csharpcode">$creds = New-Object Microsoft.WindowsAzure.StorageCredentialsAccountAndKey($SAN, $SAK)
$client = New-Object Microsoft.WindowsAzure.StorageClient.CloudBlobClient(<span class="str">&quot;https://$SAN.blob.core.windows.net&quot;</span>,$creds)</pre>
<h1>Grabbing a list of blobs &amp; deleting them</h1>
<p>One of the great things we can do is grab a list of blobs in a container using a “flat blob listing” basically, it will list everything in the container, including all the sub folders. To do this, you need to define a BlobRequestOptions object:</p>
<pre class="csharpcode">$bro = New-Object Microsoft.WindowsAzure.StorageClient.BlobRequestOptions
$bro.UseFlatBlobListing = $true</pre>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>You can grab a list of blobs for a container by using the ListBlobs method of a directory reference, which you need to grab for the container:</p>
<pre class="csharpcode">$wadcontainer = $client.GetBlobDirectoryReference(<span class="str">&quot;wad-control-container&quot;</span>)
$todelete = $wadcontainer.ListBlobs($bro) | where {$_.Uri <span class="preproc">-notmatch</span> $did}</pre>
<p>To delete the blob, you can simply call the Delete method.</p>
<pre class="csharpcode">$todelete | foreach{ $_.Delete() }</pre>
<p>Awesome. </p>
<h1>Full Script</h1>
<p>Here is the full script that also handles multiple wad-* containers:</p>
<pre class="csharpcode"><span class="rem"># TODO: Cert thumbprint of a certificate already installed into the Windows Azure Portal</span>
$thumb = <span class="str">&quot;ENTERTHUMBHERE&quot;</span>
$cert = get-item cert:\CurrentUser\My\$thumb
<span class="rem"># TODO: Subscription Id</span>
$subid = <span class="str">&quot;ENTERSUBSCRIPTIONIDHERE&quot;</span>
<span class="rem"># TODO: Storage Account Name</span>
$SAN = <span class="str">&quot;ENTERSTORAGEACCOUNTNAMEHERE&quot;</span>
<span class="rem"># TODO: Storage Account Key</span>
$SAK = <span class="str">&quot;ENTERSTORAGEACCOUNTKEYHERE&quot;</span>
<span class="rem"># TODO: Service Name</span>
$serviceName = <span class="str">&quot;ENTERSERVICENAMEHERE&quot;</span>

<span class="rem"># deployment Id</span>
$did = (Get-Deployment -ServiceName $serviceName -Certificate $cert -SubscriptionId $subid -Slot Production).DeploymentId
write-host <span class="str">&quot;current deployment &quot;</span> + $did

$creds = New-Object Microsoft.WindowsAzure.StorageCredentialsAccountAndKey($SAN, $SAK)
$client = New-Object Microsoft.WindowsAzure.StorageClient.CloudBlobClient(<span class="str">&quot;https://$SAN.blob.core.windows.net&quot;</span>,$creds)

$bro = New-Object Microsoft.WindowsAzure.StorageClient.BlobRequestOptions
$bro.UseFlatBlobListing = $true

$containersToProcess = @(<span class="str">&quot;wad-control-container&quot;</span>,<span class="str">&quot;wad-iis-logfiles&quot;</span>)
$containersToProcess | <span class="kwrd">foreach</span> {
    $wadcontainer = $client.GetBlobDirectoryReference($_)

    $todelete = $wadcontainer.ListBlobs($bro) | where {$_.Uri <span class="preproc">-notmatch</span> $did}
    $todelete | select Uri | fl | out-host

    $todelete | foreach { $_.Delete() }
}</pre>
<p><strong>Tip</strong>: If you want to see what it does before committing, simply comment out the <strong>$todelete | foreach{ $_.Delete() }</strong> statement.</p>
<p>&#160;</p>
<p>THIS POSTING IS PROVIDED “AS IS” WITH NO WARRANTIES, AND CONFERS NO RIGHTS, UNLESS YOU HAVE A NOTE FROM MY MUM</p>

]]></content:encoded>
			<wfw:commentRss>http://www.davidaiken.com/2011/10/26/how-to-clean-up-old-windows-azure-diagnostics/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How To Easily Enable Windows Azure Diagnostics Remotely</title>
		<link>http://www.davidaiken.com/2011/10/18/how-to-easily-enable-windows-azure-diagnostics-remotely/</link>
		<comments>http://www.davidaiken.com/2011/10/18/how-to-easily-enable-windows-azure-diagnostics-remotely/#comments</comments>
		<pubDate>Wed, 19 Oct 2011 05:57:10 +0000</pubDate>
		<dc:creator>theDavidAiken</dc:creator>
				<category><![CDATA[Windows Azure]]></category>
		<category><![CDATA[Diagnostics]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Tip]]></category>

		<guid isPermaLink="false">http://www.davidaiken.com/2011/10/18/how-to-easily-enable-windows-azure-diagnostics-remotely/</guid>
		<description><![CDATA[One of the great things about life is PowerShell. That could be the end of the post, but instead I’m going to add some steps on how to enable Diagnostics on a Windows Azure service once it has been deployed. This turned out to be a long post with lots of PowerShell to get excited <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://www.davidaiken.com/2011/10/18/how-to-easily-enable-windows-azure-diagnostics-remotely/" class="more-link"><span>Read More &#8594;</span></a></span>]]></description>
				<content:encoded><![CDATA[
<p>One of the great things about life is PowerShell. That could be the end of the post, but instead I’m going to add some steps on how to enable Diagnostics on a Windows Azure service once it has been deployed. This turned out to be a long post with lots of PowerShell to get excited about <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://www.davidaiken.com/wp-content/uploads/2011/10/wlEmoticon-smile.png" /></p>
<p>Apart from the obvious separation of duties &#8211; unless you are specifically debugging a service deployment issue, you don’t need to write code in your service to enable diagnostics. You will get it wrong anyway by collecting 800 counters at 1 second intervals which is not likely to be any help to anyone.</p>
<p>What I typically start out collecting is some pretty basic things, CPU, Memory Usage, Network and if it is a ASP.NET site some ASP.NET specific counters. Basically I’m looking for enough information to give me a good finger on the pulse. These can be collected at intervals between 5 and 15 minutes because we are really interested in the load over time, rather than individual peaks.</p>
<h2>Getting Started</h2>
<p>First you need to make sure you have a <a href="http://www.davidaiken.com/2009/12/21/how-to-create-a-x509-certificate-for-the-windows-azure-management-api/" target="_blank">management certificate created and installed</a>. </p>
<p>Once you have that, you need to download the PowerShell cmdlets from <a href="http://wappowershell.codeplex.com/" target="_blank">codeplex</a>.</p>
<p>Next figure out what the thumbprint of your certificate is. You can see this in the Windows Azure management portal when you click your certificate. While you are there, make a note of your subscription Id, Storage Account Name and Key and the service name.</p>
<p><strong>Tip</strong>: While I’m figuring out the right commands to use, I usually set these up as variables.</p>
<p>Rather than dump the whole script on you, let me walk you through what is happening and why. You can do this interactively in a PowerShell window if you want to follow along. The entire script is at the end. </p>
<p>Here are a few lines of the script to set the variables up:</p>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<pre class="csharpcode"><span class="rem"># TODO: Cert thumbprint of a certificate already installed into the Windows Azure Portal</span>
$thumb = <span class="str">&quot;PUTTHETHUMBHERE&quot;</span>
$cert = get-item cert:\CurrentUser\My\$thumb
<span class="rem"># TODO: Subscription Id</span>
$subid = <span class="str">&quot;PUTYOURSUBSCRIPTIONIDHERE&quot;</span>
<span class="rem"># TODO: Storage Account Name</span>
$SAN = <span class="str">&quot;PUTYOURSTORAGEACCOUNTNAMEHERE&quot;</span>
<span class="rem"># TODO: Storage Account Key</span>
$SAK = <span class="str">&quot;PUTYOURSTORAGEACCOUNTKEYHERE&quot;</span>
<span class="rem"># TODO: Service Name</span>
$serviceName = <span class="str">&quot;PUTYOURSERVICENAMEHERE&quot;</span></pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>As you can see, we can grab the actual certificate very easily using the get-item cmdlet.<br />
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<h2>Getting a list of services</h2>
<p>You can check really quickly to see if you have everything configured correctly by using the <strong>Get-HostedServices</strong> cmdlet:</p>
<pre class="csharpcode">Get-HostedServices -SubscriptionId $subid -Certificate $cert</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>This cmdlet should return a list of services you have deployed to that service account.</p>
<p>To get information on an individual service you can you <strong>Get-HostedService</strong>:</p>
<pre class="csharpcode">Get-HostedService -SubscriptionId $subid -Certificate $cert -ServiceName $serviceName</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>Before I get carried away, you can get a full list of cmdlets to explore using:</p>
<pre class="csharpcode">Get-Command -Module WAPPSCmdlets</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<h2>Getting the current deployment</h2>
<p>Back to diagnostics. When configuring diagnostics, you need to know which deployment to work with. You specify the deployment using the deployment id. You can grab the current deployment using the <strong>Get-Deployment</strong> cmdlet:</p>
<pre class="csharpcode">Get-Deployment -ServiceName $serviceName -Certificate $cert -SubscriptionId $subid -Slot Production</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>One property of the result is <strong>DeploymentId</strong>. You can grab that and save it to another variable using:</p>
<pre class="csharpcode">$did = (Get-Deployment -ServiceName $serviceName -Certificate $cert -SubscriptionId $subid -Slot Production).DeploymentId</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>Once you have the <strong>DeploymentId</strong> you use it in many of the other commands to setup log collection etc.</p>
<p>To get a list of roles you can grab the RoleInstanceList from the deployment:</p>
<pre class="csharpcode">$roles = (Get-Deployment -ServiceName $serviceName -Certificate $cert -SubscriptionId $subid -Slot Production).RoleInstanceList</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>This returns both the role names as well as the instance names.</p>
<p><strong>Note</strong>: There is a cmdlet <strong>Get-DiagnosticAwareRoles</strong> which returns the role names but not the instance names. There is also a <strong>Get-DiagnosticAwareRoleInstances</strong> which returns the instance names as strings. You could use both commands…</p>
<h3>Just Web or Worker roles</h3>
<p>Some diagnostics collection you just want to configure on web roles. I haven’t found a way from the PowerShell cmdlets to return a specific role type, so instead I always make sure my role name has the word “Web” in and use the following:</p>
<pre class="csharpcode">$webroles = $roles | where { $_.RoleName <span class="preproc">-match</span> <span class="str">&quot;Web&quot;</span>}</pre>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>I haven’t figured out a better way of doing this, if you do let me know.</p>
<p>Guess how I find worker roles?</p>
<pre class="csharpcode">$workerroles = $roles | where { $_.RoleName <span class="preproc">-notmatch</span> <span class="str">&quot;Web&quot;</span>}</pre>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>Anyway, if you have a list of roles and instance names, along with the storage account name and key and the deployment id, you are ready to go!</p>
<h2>Configure the Windows Azure Logs</h2>
<p>To configure the Windows Azure Logs you can use the <strong>Set-WindowsAzureLog</strong> cmdlet:</p>
<pre class="csharpcode">$roles | <span class="kwrd">foreach</span> { Set-WindowsAzureLog -LogLevelFilter <span class="str">&quot;Error&quot;</span> -RoleName $_.RoleName -InstanceId $_.InstanceId -StorageAccountName $SAN -StorageAccountKey $SAK -DeploymentId $did -BufferQuotaInMB 50 -TransferPeriod 5 }</pre>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>This will tell the diagnostics agent to copy the logs every 5 minutes. The total amount of data in the local log will not exceed 50MB</p>
<p>To check the configuration was set you have to use the <strong>Get-DiagnosticConfiguration</strong> cmdlet:</p>
<pre class="csharpcode">$roles | <span class="kwrd">foreach</span> {Get-DiagnosticConfiguration -DeploymentId $did -StorageAccountName $SAN -StorageAccountKey $SAK -RoleName $_.RoleName -InstanceId $_.InstanceName -BufferName Logs }</pre>
<h2>Configure the Diagnostics Infrastructure Logs</h2>
<p>To configure collection of the Windows Azure infrastructure logs use the <strong>Set-InfrastructureLog </strong>cmdlet:</p>
<pre class="csharpcode">$roles | <span class="kwrd">foreach</span> { Set-InfrastructureLog -LogLevelFilter <span class="str">&quot;Error&quot;</span> -RoleName $_.RoleName -InstanceId $_.InstanceName -BufferQuotaInMB 50 -TransferPeriod 5 -StorageAccountName $SAN -StorageAccountKey $SAK -DeploymentId $did }</pre>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>To check the configuration use:</p>
<pre class="csharpcode">$roles | <span class="kwrd">foreach</span> {Get-DiagnosticConfiguration -DeploymentId $did -StorageAccountName $SAN -StorageAccountKey $SAK -RoleName $_.RoleName -InstanceId $_.InstanceName -BufferName DiagnosticInfrastructureLogs }</pre>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<h2>Configure the Windows Event Logs</h2>
<p>To configure the collection of the Windows Event Logs use you need to first specify which logs to collect. If you just want to collect the Application and System logs, you first need to create an array:</p>
<pre class="csharpcode">$logs = <span class="str">&quot;Application!*&quot;</span>,<span class="str">&quot;System!*&quot;</span></pre>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>You can then use this list in the following: </p>
<pre class="csharpcode">$roles | <span class="kwrd">foreach</span> { Set-WAEventLog -EventLogs $logs -LogLevel <span class="str">&quot;Error&quot;</span> -RoleName $_.RoleName -InstanceId $_.InstanceName -BufferQuotaInMB 10 -TransferPeriod 5 -StorageAccountName $SAN -StorageAccountKey $SAK -DeploymentId $did }</pre>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>To check the configuration use:</p>
<pre class="csharpcode">$roles | <span class="kwrd">foreach</span> {Get-DiagnosticConfiguration -DeploymentId $did -StorageAccountName $SAN -StorageAccountKey $SAK -RoleName $_.RoleName -InstanceId $_.InstanceName -BufferName WindowsEventLogs }</pre>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<h2>Configuring Performance Counters</h2>
<p>To configure performance counters to be collected, you need to first create one or more <strong>PerformanceCounterConfiguration</strong> objects, then pass them into the <strong>Set-PerformanceCounter</strong> cmdlet.</p>
<p>To create a <strong>PerformanceCounterConfiguration</strong> object use:</p>
<pre class="csharpcode">$cpu_perfcounter = new-object Microsoft.WindowsAzure.Diagnostics.PerformanceCounterConfiguration
$cpu_perfcounter.CounterSpecifier = <span class="str">&quot;\Processor(_Total)\% Processor Time&quot;</span>
$cpu_perfcounter.SampleRate = new TimeSpan(0,5,0)</pre>
<p>For all roles, you should create performance counters for the following:</p>
<ul>
<li>\Processor(_Total)\% Processor Time </li>
<li>\Memory\Available Mbytes </li>
<li>\Memory\Committed Bytes </li>
<li>\Network Interface(*)\Bytes Received/sec </li>
<li>\Network Interface(*)\Bytes Sent/sec </li>
</ul>
<p>For a webrole you should add at least:</p>
<ul>
<li>\ASP.NET Applications(__Total__)\Requests/Sec </li>
</ul>
<p>Once you have created each PerformanceCounterConfiguration object create an array then use the Set-PerformanceCounter cmdlet:</p>
<pre class="csharpcode">$cpu_perfcounter = new-object Microsoft.WindowsAzure.Diagnostics.PerformanceCounterConfiguration
$cpu_perfcounter.CounterSpecifier = <span class="str">&quot;\Processor(_Total)\% Processor Time&quot;</span>
$cpu_perfcounter.SampleRate = $counter_time</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<div class="csharpcode">To view the performance counters, you can use:</div>
<pre class="csharpcode">Get-DiagnosticConfiguration -DeploymentId $did -StorageAccountName $SAN -StorageAccountKey $SAK -RoleName $_.RoleName -InstanceId $_.InstanceName -BufferName PerformanceCounters    </pre>
<p>If you actually want to view the performance counter names and sample times you need to look at the datasources property:</p>
<pre class="csharpcode">(Get-DiagnosticConfiguration -DeploymentId $did -StorageAccountName $SAN -StorageAccountKey $SAK -RoleName $_.RoleName -InstanceId $_.InstanceName -BufferName PerformanceCounters).DataSources</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<h2>Configuring IIS Log Files</h2>
<p>Windows Azure lets you configure the collection of any log files. Typically for a web role you would want to grab the IIS log files. In order to do this, you have to configure a datasource that specifies which folder the log files will be located in. To figure this out, the pattern is:</p>
<pre class="csharpcode">C:\Resources\directory\&lt;DeploymentId&gt;.&lt;RoleName&gt;.DiagnosticStore\LogFiles</pre>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
</p>
<p>Which can be constructed using:</p>
<pre class="csharpcode">$logfile = <span class="str">&quot;C:\Resources\directory\&quot; + $did + &quot;</span>.<span class="str">&quot; + $WebRoles[0].RoleName + &quot;</span>.DiagnosticStore\LogFiles&quot;</pre>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>Other formats are Failed Request Logs</p>
<pre class="csharpcode">C:\Resources\directory\&lt;DeploymentID&gt;.&lt;RoleName&gt;\FailedReqLogFile</pre>
<p>and Crash Dumps:</p>
<pre class="csharpcode"> C:\Resources\directory\&lt;DeploymentId&gt;.&lt;RoleName&gt;\CrashDumps</pre>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>To create the actual datasource, you need to create an instance of DirectoryConfiguration:</p>
<pre class="csharpcode">$iisDirectorySource = new-object -TypeName Microsoft.WindowsAzure.Diagnostics.DirectoryConfiguration
$iisDirectorySource.Path = $logfile
$iisDirectorySource.DirectoryQuotaInMB = 100
$iisDirectorySource.Container = <span class="str">&quot;wad-iis-logfiles&quot;</span></pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>You can then set the directory sources:</p>
<pre class="csharpcode">$webroles | <span class="kwrd">foreach</span> { Set-FileBasedLog -DirectoriesConfiguration @($iisDirectorySource) -RoleName $_.RoleName -InstanceId $_.InstanceId -BufferQuotaInMB 1024 -TransferPeriod 5 -StorageAccountName $SAN -StorageAccountKey $SAK -DeploymentId $did }</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>Phew – made it.</p>
<p>Here is the full script for setting the configuration, followed by a script that will display the configuration:</p>
<pre class="csharpcode"><span class="rem"># TODO: Cert thumbprint of a certificate already installed into the Windows Azure Portal</span>
$thumb = <span class="str">&quot;ENTERTHUMBHERE&quot;</span>
$cert = get-item cert:\CurrentUser\My\$thumb
<span class="rem"># TODO: Subscription Id</span>
$subid = <span class="str">&quot;ENTERSUBIDHERE&quot;</span>
<span class="rem"># TODO: Storage Account Name</span>
$SAN = <span class="str">&quot;ENTERSTORAGEACCOUNTNAMEHERE&quot;</span>
<span class="rem"># TODO: Storage Account Key</span>
$SAK = <span class="str">&quot;ENTERSTORAGEACCOUNTKEYHERE&quot;</span>
<span class="rem"># TODO: Service Name</span>
$serviceName = <span class="str">&quot;ENTERSERVICENAMEHERE&quot;</span>

<span class="rem"># You can leave the remainder of the script alone, will collect some good counters at 5 minute intervals and setup logging of event logs etc.</span>
<span class="rem"># Does not setup Fail Request Logs</span>
<span class="rem"># </span>
<span class="rem"># Logs to collect</span>
$logs = <span class="str">&quot;Application!*&quot;</span>,<span class="str">&quot;System!*&quot;</span>
<span class="rem"># configure performance counters sample TimeSpan (h,m,s) - recommended 5 - 15 minutes</span>
$counter_time = new-object TimeSpan(0,10,0)
<span class="rem"># Configure default collection time (recommended 5-15 minutes)</span>
$transferPeriod = 5

<span class="rem"># performance counters</span>
$cpu_perfcounter = new-object Microsoft.WindowsAzure.Diagnostics.PerformanceCounterConfiguration
$cpu_perfcounter.CounterSpecifier = <span class="str">&quot;\Processor(_Total)\% Processor Time&quot;</span>
$cpu_perfcounter.SampleRate = $counter_time

$mem_available_bytes_perfcounter = New-Object Microsoft.WindowsAzure.Diagnostics.PerformanceCounterConfiguration
$mem_available_bytes_perfcounter.CounterSpecifier = <span class="str">&quot;\Memory\Available Mbytes&quot;</span>
$mem_available_bytes_perfcounter.SampleRate = $counter_time

$mem_committed_bytes_perfcounter = New-Object Microsoft.WindowsAzure.Diagnostics.PerformanceCounterConfiguration
$mem_committed_bytes_perfcounter.CounterSpecifier = <span class="str">&quot;\Memory\Committed Bytes&quot;</span>
$mem_committed_bytes_perfcounter.SampleRate =$counter_time

$asp_app_requests_perfcounter =  New-Object Microsoft.WindowsAzure.Diagnostics.PerformanceCounterConfiguration
$asp_app_requests_perfcounter.CounterSpecifier = <span class="str">&quot;\ASP.NET Applications(__Total__)\Requests/Sec&quot;</span>
$asp_app_requests_perfcounter.SampleRate = $counter_time

$net_received_perfcounter =  New-Object Microsoft.WindowsAzure.Diagnostics.PerformanceCounterConfiguration
$net_received_perfcounter.CounterSpecifier = <span class="str">&quot;\Network Interface(*)\Bytes Received/sec&quot;</span>
$net_received_perfcounter.SampleRate = $counter_time

$net_sent_perfcounter =  New-Object Microsoft.WindowsAzure.Diagnostics.PerformanceCounterConfiguration
$net_sent_perfcounter.CounterSpecifier = <span class="str">&quot;\Network Interface(*)\Bytes Sent/sec&quot;</span>
$net_sent_perfcounter.SampleRate = $counter_time

<span class="rem"># deployment Id</span>
$did = (Get-Deployment -ServiceName $serviceName -Certificate $cert -SubscriptionId $subid -Slot Production).DeploymentId
<span class="rem"># Role List</span>
$roles = (Get-Deployment -ServiceName $serviceName -Certificate $cert -SubscriptionId $subid -Slot Production).RoleInstanceList

<span class="rem">#Web Role List</span>
$webroles = $roles | where { $_.RoleName <span class="preproc">-match</span> <span class="str">&quot;Web&quot;</span>}
<span class="rem">#worker Role List</span>
$workerroles = $roles | where { $_.RoleName <span class="preproc">-notmatch</span> <span class="str">&quot;Web&quot;</span>}

$roles | <span class="kwrd">foreach</span> { Set-WindowsAzureLog -LogLevelFilter <span class="str">&quot;Error&quot;</span> -RoleName $_.RoleName -InstanceId $_.InstanceName -BufferQuotaInMB 50 -TransferPeriod $transferPeriod -StorageAccountName $SAN -StorageAccountKey $SAK -DeploymentId $did}

$roles | <span class="kwrd">foreach</span> { Set-InfrastructureLog -LogLevelFilter <span class="str">&quot;Error&quot;</span> -RoleName $_.RoleName -InstanceId $_.InstanceName -BufferQuotaInMB 50 -TransferPeriod $transferPeriod -StorageAccountName $SAN -StorageAccountKey $SAK -DeploymentId $did }

$logs = <span class="str">&quot;Application!*&quot;</span>,<span class="str">&quot;System!*&quot;</span>
$roles | <span class="kwrd">foreach</span> { Set-WAEventLog -EventLogs $logs -LogLevel <span class="str">&quot;Error&quot;</span> -RoleName $_.RoleName -InstanceId $_.InstanceName -BufferQuotaInMB 10 -TransferPeriod $transferPeriod -StorageAccountName $SAN -StorageAccountKey $SAK -DeploymentId $did }

<span class="rem">#Web Role Specific Configuration</span>
<span class="kwrd">if</span> ($WebRoles <span class="preproc">-ne</span> $null)
{
    $logfile = <span class="str">&quot;C:\Resources\directory\&quot; + $did + &quot;</span>.<span class="str">&quot; + $WebRoles[0].RoleName + &quot;</span>.DiagnosticStore\LogFiles<span class="str">&quot;

    $iisDirectorySource = new-object -TypeName Microsoft.WindowsAzure.Diagnostics.DirectoryConfiguration
    $iisDirectorySource.Path = $logfile
    $iisDirectorySource.DirectoryQuotaInMB = 100
    $iisDirectorySource.Container = &quot;</span>wad-iis-logfiles&quot;

    $webroles | <span class="kwrd">foreach</span> { Set-FileBasedLog -DirectoriesConfiguration @($iisDirectorySource) -RoleName $_.RoleName -InstanceId $_.InstanceId -BufferQuotaInMB 1024 -TransferPeriod 5 -StorageAccountName $SAN -StorageAccountKey $SAK -DeploymentId $did }
    
    $web_perf_counters = $cpu_perfcounter, $mem_available_bytes_perfcounter, $mem_committed_bytes_perfcounter, $net_received_perfcounter, $net_sent_perfcounter, $asp_app_requests_perfcounter
    $webroles | <span class="kwrd">foreach</span> { Set-PerformanceCounter -PerformanceCounters $web_perf_counters -RoleName $_.RoleName -InstanceId $_.InstanceName -BufferQuotaInMB 10 -TransferPeriod $transferPeriod -StorageAccountName $SAN -StorageAccountKey $SAK -DeploymentId $did } 
}

<span class="rem">#Worker Role Specific Configuration</span>
<span class="kwrd">if</span> ($workerroles <span class="preproc">-ne</span> $null)
{    
    $worker_perf_counters = $cpu_perfcounter, $mem_available_bytes_perfcounter, $mem_committed_bytes_perfcounter, $net_received_perfcounter, $net_sent_perfcounter
    $workerroles | <span class="kwrd">foreach</span> { Set-PerformanceCounter -PerformanceCounters $worker_perf_counters -RoleName $_.RoleName -InstanceId $_.InstanceName -BufferQuotaInMB 10 -TransferPeriod $transferPeriod -StorageAccountName $SAN -StorageAccountKey $SAK -DeploymentId $did } 
}</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>The display script:</p>
<pre class="csharpcode"><span class="rem"># TODO: Cert thumbprint of a certificate already installed into the Windows Azure Portal</span>
$thumb = <span class="str">&quot;ENTERTHUMBHERE&quot;</span>
$cert = get-item cert:\CurrentUser\My\$thumb
<span class="rem"># TODO: Subscription Id</span>
$subid = <span class="str">&quot;ENTERSUBIDHERE&quot;</span>
<span class="rem"># TODO: Storage Account Name</span>
$SAN = <span class="str">&quot;ENTERSTORAGEACCOUNTNAMEHERE&quot;</span>
<span class="rem"># TODO: Storage Account Key</span>
$SAK = <span class="str">&quot;ENTERSTORAGEACCOUNTKEYHERE&quot;</span>
<span class="rem"># TODO: Service Name</span>
$serviceName = <span class="str">&quot;ENTERSERVICENAMEHERE&quot;</span>


<span class="rem"># deployment Id</span>
$did = (Get-Deployment -ServiceName $serviceName -Certificate $cert -SubscriptionId $subid -Slot Production).DeploymentId
<span class="rem"># Role List</span>
$roles = (Get-Deployment -ServiceName $serviceName -Certificate $cert -SubscriptionId $subid -Slot Production).RoleInstanceList

$roles | <span class="kwrd">foreach</span> {
    write-host <span class="str">&quot;======================================================&quot;</span>
    write-host $_.RoleName 
    write-host $_.InstanceName

    write-host <span class="str">&quot;Event Logs&quot;</span>
    Get-DiagnosticConfiguration -DeploymentId $did -StorageAccountName $SAN -StorageAccountKey $SAK -RoleName $_.RoleName -InstanceId $_.InstanceName -BufferName WindowsEventLogs | out-host
        
    write-host <span class="str">&quot;Infrastructure Logs&quot;</span>
    Get-DiagnosticConfiguration -DeploymentId $did -StorageAccountName $SAN -StorageAccountKey $SAK -RoleName $_.RoleName -InstanceId $_.InstanceName -BufferName DiagnosticInfrastructureLogs 

    write-host <span class="str">&quot;Logs&quot;</span>
    Get-DiagnosticConfiguration -DeploymentId $did -StorageAccountName $SAN -StorageAccountKey $SAK -RoleName $_.RoleName -InstanceId $_.InstanceName -BufferName Logs 

    write-host <span class="str">&quot;Performance Counters&quot;</span>
    Get-DiagnosticConfiguration -DeploymentId $did -StorageAccountName $SAN -StorageAccountKey $SAK -RoleName $_.RoleName -InstanceId $_.InstanceName -BufferName PerformanceCounters | out-host    
    (Get-DiagnosticConfiguration -DeploymentId $did -StorageAccountName $SAN -StorageAccountKey $SAK -RoleName $_.RoleName -InstanceId $_.InstanceName -BufferName PerformanceCounters).DataSources | out-host
    
    
    write-host <span class="str">&quot;Directories&quot;</span>
    Get-DiagnosticConfiguration -DeploymentId $did -StorageAccountName $SAN -StorageAccountKey $SAK -RoleName $_.RoleName -InstanceId $_.InstanceName -BufferName Directories | out-host
    (Get-DiagnosticConfiguration -DeploymentId $did -StorageAccountName $SAN -StorageAccountKey $SAK -RoleName $_.RoleName -InstanceId $_.InstanceName -BufferName Directories).DataSources | fl | out-host
    
    write-host <span class="str">&quot;&quot;</span>
}</pre>
<p>THIS POSTING IS PROVIDED “AS IS” WITH NO WARRANTIES, AND CONFERS NO RIGHTS, EVEN IF YOU HAVE CHOCOLATE</p>

]]></content:encoded>
			<wfw:commentRss>http://www.davidaiken.com/2011/10/18/how-to-easily-enable-windows-azure-diagnostics-remotely/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How To Block un-validated Windows Azure Deployments</title>
		<link>http://www.davidaiken.com/2011/10/13/how-to-block-un-validated-windows-azure-deployments/</link>
		<comments>http://www.davidaiken.com/2011/10/13/how-to-block-un-validated-windows-azure-deployments/#comments</comments>
		<pubDate>Thu, 13 Oct 2011 22:23:06 +0000</pubDate>
		<dc:creator>theDavidAiken</dc:creator>
				<category><![CDATA[Windows Azure]]></category>
		<category><![CDATA[Tip]]></category>

		<guid isPermaLink="false">http://www.davidaiken.com/2011/10/13/how-to-block-un-validated-windows-azure-deployments/</guid>
		<description><![CDATA[One of the great things about the 1.4/1.5 SDK tools is the validation that is now performed on Windows Azure packages. This makes it easy to check before you deploy things like missing dependencies. As an example, here is a project warning generated when a dependency is not set to be copied local. One thing <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://www.davidaiken.com/2011/10/13/how-to-block-un-validated-windows-azure-deployments/" class="more-link"><span>Read More &#8594;</span></a></span>]]></description>
				<content:encoded><![CDATA[
<p>One of the great things about the 1.4/1.5 SDK tools is the validation that is now performed on Windows Azure packages. This makes it easy to check before you deploy things like missing dependencies. As an example, here is a project warning generated when a dependency is not set to be copied local.</p>
<p><a href="http://www.davidaiken.com/wp-content/uploads/2011/10/image.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.davidaiken.com/wp-content/uploads/2011/10/image_thumb.png" width="575" height="139" /></a></p>
<p>One thing that always annoyed me is that it is a warning and not an error. I may have in the past deployed packages that failed, just because I wasn’t looking at the errors.</p>
<p>However you can actually have these warnings block your deployment by setting the “Treat warnings as errors” option on your Windows Azure project to true. (Tip: right click your Windows Azure project, click properties, then click Development.)</p>
<p><a href="http://www.davidaiken.com/wp-content/uploads/2011/10/image1.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.davidaiken.com/wp-content/uploads/2011/10/image_thumb1.png" width="293" height="193" /></a></p>
<p>Which changes the warnings to errors:</p>
<p><a href="http://www.davidaiken.com/wp-content/uploads/2011/10/image2.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.davidaiken.com/wp-content/uploads/2011/10/image_thumb2.png" width="578" height="181" /></a></p>
<p>Awesome.</p>
<p>THIS POSTING IS PROVIDED “AS IS” WITH NO WARRANTIES, AND CONFERS NO RIGHTS OR DANCING CATS</p>

]]></content:encoded>
			<wfw:commentRss>http://www.davidaiken.com/2011/10/13/how-to-block-un-validated-windows-azure-deployments/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Implementing Windows Azure Retry Logic</title>
		<link>http://www.davidaiken.com/2011/10/10/implementing-windows-azure-retry-logic/</link>
		<comments>http://www.davidaiken.com/2011/10/10/implementing-windows-azure-retry-logic/#comments</comments>
		<pubDate>Mon, 10 Oct 2011 20:02:44 +0000</pubDate>
		<dc:creator>theDavidAiken</dc:creator>
				<category><![CDATA[SQL Azure]]></category>
		<category><![CDATA[Windows Azure]]></category>
		<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[Retry Logic]]></category>

		<guid isPermaLink="false">http://www.davidaiken.com/?p=220</guid>
		<description><![CDATA[Windows Azure will automatically repair itself. Can your service? In this post I’m going to show you a simple way to make your service a little more resilient by adding retry logic. Transient Datacenter conditions When you have to deal with external services of any type there are times when the service might not respond. <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://www.davidaiken.com/2011/10/10/implementing-windows-azure-retry-logic/" class="more-link"><span>Read More &#8594;</span></a></span>]]></description>
				<content:encoded><![CDATA[
<p>Windows Azure will automatically repair itself. Can your service? In this post I’m going to show you a simple way to make your service a little more resilient by adding retry logic.</p>
<h1>Transient Datacenter conditions</h1>
<p>When you have to deal with external services of any type there are times when the service might not respond. This could be due to any number of reasons from network connectivity &amp; service throttling, to hardware failure. Windows Azure is designed to withstand these failures, not by avoiding them, but by taking corrective action when they do occur. Windows Azure auto heals itself. These conditions are sometimes referred to as transient conditions because they are not typically long lasting.</p>
<p>As an example, SQL Azure can give you <a href="http://msdn.microsoft.com/en-us/library/4cff491e-9359-4454-bd7c-fb72c4c452ca#bkmk_throt_errors" target="_blank">connection errors</a>, and <a href="http://msdn.microsoft.com/en-us/library/4cff491e-9359-4454-bd7c-fb72c4c452ca#bkmk_throt_errors" target="_blank">throttling errors</a>, Windows Azure Storage can give you timeout and throttling errors and Service Bus has <a href="http://msdn.microsoft.com/en-us/library/microsoft.servicebus.messaging.serverbusyexception.aspx" target="_blank">ServerBusy</a> and <a href="http://msdn.microsoft.com/en-us/library/microsoft.servicebus.messaging.messagingcommunicationexception.aspx" target="_blank">MessagingCommunication</a> Exceptions.</p>
<p>Any other external dependency will also likely have similar conditions. Without defensive coding for these transient conditions, your app will suffer unnecessary outages. Fortunately the problem can be easily resolved.</p>
<h1>Retry Logic</h1>
<p>Handling these conditions is usually as easy as repeating the operation after a short delay. </p>
<p>The Windows Azure Storage Client Library that ships with the SDK already has <a href="http://blogs.msdn.com/b/windowsazurestorage/archive/2011/02/03/overview-of-retry-policies-in-the-windows-azure-storage-client-library.aspx" target="_blank">retry behavior</a> that you need to switch on. You can set this on any storage client by setting the <strong>RetryPolicy</strong> Property.</p>
<p>SQL Azure doesn’t provide a default retry mechanism out of the box, since it uses the SQL Server client libraries. Service Bus also doesn’t provide a retry mechanism.</p>
<h2>Transient Fault Handling Framework</h2>
<p>To provide an easy way to handle this, the Windows Azure Customer Advisory Team have developed a Transient Fault Handling Framework &#8211; <a title="http://windowsazurecat.com/2011/02/transient-fault-handling-framework/" href="http://windowsazurecat.com/2011/02/transient-fault-handling-framework/">http://windowsazurecat.com/2011/02/transient-fault-handling-framework/</a>. The framework provides a number of ways to handle specific SQL Azure, Storage, Service Bus and Cache conditions. </p>
<p>The most interesting aspect to me however is the <strong>ExecuteAction</strong> and <strong>ExecuteAction&lt;T&gt;</strong> methods. These methods allow you to basically wrap any user code in a retry block. Example:</p>
<pre style="width: 105.39%; height: 53px" class="csharpcode">var policy = <span class="kwrd">new</span> RetryPolicy&lt;SqlAzureTransientErrorDetectionStrategy&gt;(MaxRetries,
                    TimeSpan.FromMilliseconds(DelayMs));
policy.ExecuteAction(() =&gt; <span class="kwrd">object</span>.DoSomething());</pre>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
</p>
<h2>Retry Pattern</h2>
<p>What is great about these methods are they enable you to use the <a href="http://en.wikipedia.org/wiki/Decorator_pattern" target="_blank">decorator pattern</a> to add retry logic to your service. This of course assumes you built your service with extensibility in mind. </p>
<p>In my example I have a <strong>UriRepository </strong>which is defined by the <strong>IUriRepository</strong> interface. I have a <strong>SQLAzureUriRepository</strong> that implements the interface. This class however contains no retry logic. Instead I implemented a <strong>RetryUriRepository</strong> that also implements <strong>IUriRepository</strong>. <strong>RetryUriRepository</strong> allows you to specify via constructor injection, which <strong>UriRepositiory</strong> to retry.</p>
<p>Here is a snippet of the <strong>RetryUriRepository</strong>:</p>
<pre style="width: 106.32%; height: 345px" class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">class</span> RetryUriRepository : IUriRepository
{
    <span class="kwrd">private</span> <span class="kwrd">readonly</span> IUriRepository _uriRepository;
    <span class="kwrd">private</span> <span class="kwrd">const</span> <span class="kwrd">int</span> MaxRetries = 10;
    <span class="kwrd">private</span> <span class="kwrd">const</span> <span class="kwrd">double</span> DelayMs = 2000;

    <span class="kwrd">public</span> RetryUriRepository(IUriRepository uriRepository)
    {   _uriRepository = uriRepository;    }

    <span class="kwrd">public</span> <span class="kwrd">void</span> InsertUri(<span class="kwrd">string</span> shortUri, <span class="kwrd">string</span> longUri, <span class="kwrd">string</span> ipAddress)
    {
        var policy = GetRetryPolicy();
        policy.ExecuteAction(() =&gt; _uriRepository.InsertUri(shortUri, longUri, ipAddress));
    }
    <span class="kwrd">private</span> <span class="kwrd">static</span> RetryPolicy GetRetryPolicy()
    {
        <span class="kwrd">return</span> <span class="kwrd">new</span> RetryPolicy&lt;SqlAzureTransientErrorDetectionStrategy&gt;(MaxRetries,&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; TimeSpan.FromMilliseconds(DelayMs));
    }
}</pre>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>Using the supplied framework might be overkill, but it should give you an idea on how to implement retry logic in your service.</p>
<h1>Too Much Retry</h1>
<p>One thing that becomes interesting is when the number of retries increases. This typically indicates either a longer error condition, or you are overloading the services you are consuming. The most likely, and only one we can do anything about, is the later. The more throttling that goes on, the more retires. The more retires the less throughput. The less throughput the slower the response time. Poor response time = disgruntled users (and executives).</p>
<p>Don’t be tempted to turn off the retry logic when this happens. This will just make the problem much worse. About the only solution when dealing with overloading a service is to either scale that service out, or attempt to delay the processing using a queue/worker pattern.</p>
<h1>Conclusion</h1>
<p>Implementing retry logic is critical if you want your service to keep running. Monitoring the frequency of these retries can be a good indicator you are starting to experience scale issues. Don’t turn your retry logic off to handle scale issues.</p>
<p>THIS POSTING IS PROVIDED “AS IS” WITH NO WARRANTIES, AND CONFERS NO RIGHTS, EXCEPT ON THE THIRD SUNDAY WITH A FULL MOON</p>

]]></content:encoded>
			<wfw:commentRss>http://www.davidaiken.com/2011/10/10/implementing-windows-azure-retry-logic/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Our datacenters are awesomeness in a box</title>
		<link>http://www.davidaiken.com/2011/10/07/our-datacenters-are-awesomeness-in-a-box/</link>
		<comments>http://www.davidaiken.com/2011/10/07/our-datacenters-are-awesomeness-in-a-box/#comments</comments>
		<pubDate>Fri, 07 Oct 2011 18:51:42 +0000</pubDate>
		<dc:creator>theDavidAiken</dc:creator>
				<category><![CDATA[Windows Azure]]></category>
		<category><![CDATA[Datacenter]]></category>
		<category><![CDATA[Geek]]></category>

		<guid isPermaLink="false">http://www.davidaiken.com/2011/10/07/our-datacenters-are-awesomeness-in-a-box/</guid>
		<description><![CDATA[Last week I attended the (first?) Seattle Windows Azure User Group meeting. One of the topics of conversation was around datacenters. (Tip: We typically don’t build them above bakeries). We don’t as a rule talk very much about how awesome they are – although there are a few videos out there which are great for <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://www.davidaiken.com/2011/10/07/our-datacenters-are-awesomeness-in-a-box/" class="more-link"><span>Read More &#8594;</span></a></span>]]></description>
				<content:encoded><![CDATA[
<p>Last week I attended the (first?) <a href="http://groups.google.com/group/windows-azure" target="_blank">Seattle Windows Azure User Group</a> meeting. One of the topics of conversation was around datacenters. (Tip: We typically don’t build them above bakeries). </p>
<p>We don’t as a rule talk very much about how awesome they are – although there are a few videos out there which are great for a Friday lunchtime watch.</p>
<h4>Guided Tour inside the Windows Azure Cloud with Patrick Yantz</h4>
<p> <iframe style="width: 512px; height: 288px" src="http://channel9.msdn.com/Shows/HanselminutesOn9/Hanselminutes-on-9-Guided-Tour-inside-the-Windows-Azure-Cloud-with-Patrick-Yantz/player?w=512&amp;h=288" frameborder="0" scrolling="no"></iframe><br />
<h4>A great animation of the ITPAC</h4>
<p> <object style="height: 390px; width: 640px"><param name="movie" value="http://www.youtube.com/v/nIliMskAHro?version=3"><param name="allowFullScreen" value="true"><param name="allowScriptAccess" value="always"><embed src="http://www.youtube.com/v/nIliMskAHro?version=3" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="640" height="360"></object><br />
<h4>Our recent GFS datacenter tour video</h4>
<p> <object width="640" height="360"><param name="movie" value="http://www.youtube.com/v/hOxA1l1pQIw&amp;rel=0&amp;hl=en_US&amp;feature=player_embedded&amp;version=3"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.youtube.com/v/hOxA1l1pQIw&amp;rel=0&amp;hl=en_US&amp;feature=player_embedded&amp;version=3" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="640" height="360"></embed></object>
<p>You can find more geeky videos on the Microsoft Global Foundation Services site at <a title="http://www.globalfoundationservices.com/infrastructure/videos.html" href="http://www.globalfoundationservices.com/infrastructure/videos.html">http://www.globalfoundationservices.com/infrastructure/videos.html</a>.</p>
<p>Just a note, these are videos about our datacenters and not just Windows Azure.</p>
<p>BTW – if you are in the Seattle area, you should <a href="http://groups.google.com/group/windows-azure" target="_blank">join the user group</a>. People like <a href="http://blog.smarx.com/" target="_blank">Steve Marx</a> &amp; <a href="http://blogs.msdn.com/b/vbertocci/" target="_blank">Vittorio Bertocci</a> might even be there.</p>
<p>THIS POSTING IS PROVIDED “AS IS” WITH NO WARRANTIES, AND CONFERS NO RIGHTS</p>

]]></content:encoded>
			<wfw:commentRss>http://www.davidaiken.com/2011/10/07/our-datacenters-are-awesomeness-in-a-box/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Please scale your storage too</title>
		<link>http://www.davidaiken.com/2011/10/06/please-scale-your-storage-too/</link>
		<comments>http://www.davidaiken.com/2011/10/06/please-scale-your-storage-too/#comments</comments>
		<pubDate>Thu, 06 Oct 2011 22:33:09 +0000</pubDate>
		<dc:creator>theDavidAiken</dc:creator>
				<category><![CDATA[Windows Azure]]></category>
		<category><![CDATA[Scaling Out]]></category>
		<category><![CDATA[SQL Azure]]></category>

		<guid isPermaLink="false">http://www.davidaiken.com/2011/10/06/please-scale-your-storage-too/</guid>
		<description><![CDATA[Everyone understands the concept of scaling out compute when building applications for Windows Azure, but many times I’m seeing storage left out of the equation. The results are applications that don’t scale because they are tied to a single database. In this post I will explain how you need to start thinking about storage in <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://www.davidaiken.com/2011/10/06/please-scale-your-storage-too/" class="more-link"><span>Read More &#8594;</span></a></span>]]></description>
				<content:encoded><![CDATA[
<p>Everyone understands the concept of scaling out compute when building applications for Windows Azure, but many times I’m seeing storage left out of the equation. The results are applications that don’t scale because they are tied to a single database. In this post I will explain how you need to start thinking about storage in the cloud.</p>
<h4>Storage on-premises</h4>
<p>If you think about how you build big applications on premises and how you approach data in general is very different. Typically you have a database or storage standard. This could be SQL Server, or some other relational database. The law of the enterprise is usually “all data shall be stored in &lt;insert your enterprise database here&gt;”. There is no other choice.</p>
<p>The second big difference is how you approach scale. Typically to get scale, you build the biggest most elaborate database server you can. I remember years ago, tuning everything from the hardware, through to how the disks were partitioned and where the file groups in SQL Server were located and used. Machines typically had multiple CPU’s with multiple cores, multiple disk controllers, disks and a bucket full of RAM.</p>
<p>If you also needed high availability, that was easy. You typically built a second monster machine and configured an Active/Passive setup, or hot standby,</p>
<h4>How the cloud changes storage</h4>
<p>The first thing about using storage in the cloud is that there are zero setup costs. You can just as easily create a SQL Azure database or 7. Create multiple storage accounts, tables etc. You pay for what you consume. Setup is free. This means you have less reason to put all your data in one place. You can start thinking about which data source is right for what data. It is not unusual to have multiple data sources used.</p>
<p>The second big thing is that we don’t have that big huge server with lots of cores and ram and fancy stuff. At least not tuned to the extent you would for your workload. Instead we have “commodity hardware”. To achieve “scale” you have to think about using lots of little storage things, rather than a single huge one. This is the exact same thing you do with compute.</p>
<p>If you have 50GB of data, you may be better served by 50 x 1GB databases than 1 x 50GB. The cost is comparable too. Except you now have 50 of those servers running your database. Guess which model will scale better?</p>
<p>There is a tax in thinking about, designing and implementing this – however if done right, you can scale out as far as your compute (and credit card) will let you.</p>
<p>This might have been a rant. Apologies. </p>
<p>THIS POSTING IS PROVIDED “AS IS” WITH NO WARRANTIES, AND CONFERS NO RIGHTS</p>

]]></content:encoded>
			<wfw:commentRss>http://www.davidaiken.com/2011/10/06/please-scale-your-storage-too/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hiding Response Headers</title>
		<link>http://www.davidaiken.com/2011/10/04/hiding-response-headers/</link>
		<comments>http://www.davidaiken.com/2011/10/04/hiding-response-headers/#comments</comments>
		<pubDate>Tue, 04 Oct 2011 22:18:26 +0000</pubDate>
		<dc:creator>theDavidAiken</dc:creator>
				<category><![CDATA[Windows Azure]]></category>

		<guid isPermaLink="false">http://www.davidaiken.com/?p=213</guid>
		<description><![CDATA[Every once and a while I get a question that makes me think, hmm. Today I received one such question, and it was “How do I hide my server header information?”. First, this is what you get as a default: It looks like there are 4 things that need removing X-Powered-By, X-AspNet-Version, X-AspNetMvc-Version and Server. <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://www.davidaiken.com/2011/10/04/hiding-response-headers/" class="more-link"><span>Read More &#8594;</span></a></span>]]></description>
				<content:encoded><![CDATA[
<p>Every once and a while I get a question that makes me think, hmm. Today I received one such question, and it was “How do I hide my server header information?”.</p>
<p>First, this is what you get as a default:</p>
<p><a href="http://www.davidaiken.com/wp-content/uploads/2011/10/hmblmehearderswithouthidingthem.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="hmblmehearderswithouthidingthem" border="0" alt="hmblmehearderswithouthidingthem" src="http://www.davidaiken.com/wp-content/uploads/2011/10/hmblmehearderswithouthidingthem_thumb.png" width="597" height="399" /></a></p>
<p>It looks like there are 4 things that need removing X-Powered-By, X-AspNet-Version, X-AspNetMvc-Version and Server.</p>
<p>The first 2 tags can be removed by editing the web.config of your application:</p>
<p>To remove the “X-AspNet-Version” tag, in &lt;system.web&gt; add:</p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">httpRuntime</span> <span class="attr">enableVersionHeader</span><span class="kwrd">=&quot;false&quot;</span> <span class="kwrd">/&gt;</span></pre>
<p>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>To remove the “X-Powered-By”, in &lt;system.webServer&gt; add:</p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">httpProtocol</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">customHeaders</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">remove</span> <span class="attr">name</span><span class="kwrd">=&quot;X-Powered-By&quot;</span> <span class="kwrd">/&gt;</span>
  <span class="kwrd">&lt;/</span><span class="html">customHeaders</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">httpProtocol</span><span class="kwrd">&gt;</span></pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>To remove the “X-AspNetMvc-Version” you need to edit you Global.asax.cs and add the following to the Application_Start() method:</p>
<pre class="csharpcode">MvcHandler.DisableMvcResponseHeader = <span class="kwrd">true</span>;</pre>
<p>Removing the “Server” tag is a little harder. The only thing I could find was (and I spent around 30 seconds looking) was this great post from <a href="http://blogs.technet.com/b/stefan_gossner/archive/2008/03/12/iis-7-how-to-send-a-custom-server-http-header.aspx" target="_blank">Stefan Goßner</a> which I adapted to remove the header. It requires you install a custom Http Module into IIS. Here is the code:</p>
<pre class="csharpcode"><span class="kwrd">using</span> System;
<span class="kwrd">using</span> System.Web;

<span class="kwrd">namespace</span> ServerHeaders
{
    <span class="kwrd">public</span> <span class="kwrd">class</span> CustomServerHeaderModule : IHttpModule
    {
        <span class="kwrd">public</span> <span class="kwrd">void</span> Init(HttpApplication context)
        {            
            context.PreSendRequestHeaders += OnPreSendRequestHeaders;
        }
        <span class="kwrd">public</span> <span class="kwrd">void</span> Dispose() { }
        <span class="kwrd">static</span> <span class="kwrd">void</span> OnPreSendRequestHeaders(<span class="kwrd">object</span> sender, EventArgs e)
        {
            <span class="rem">// remove the &quot;Server&quot; Http Header</span>
            HttpContext.Current.Response.Headers.Remove(<span class="str">&quot;Server&quot;</span>);
        }
    } 
}</pre>
<p>I created a new class project for this class, then added a reference to the project from the web application. To wire up the handler I updated the &lt;modules&gt; tag to the following:</p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">modules</span> <span class="attr">runAllManagedModulesForAllRequests</span><span class="kwrd">=&quot;true&quot;</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">add</span> <span class="attr">name</span><span class="kwrd">=&quot;CustomServerHeader&quot;</span> <span class="attr">type</span><span class="kwrd">=&quot;ServerHeaders.CustomServerHeaderModule&quot;</span> <span class="kwrd">/&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">modules</span><span class="kwrd">&gt;</span></pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>Deploying to Windows Azure yields:</p>
<p><a href="http://www.davidaiken.com/wp-content/uploads/2011/10/noheaders.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="noheaders" border="0" alt="noheaders" src="http://www.davidaiken.com/wp-content/uploads/2011/10/noheaders_thumb.png" width="568" height="413" /></a></p>
<p>THIS POSTING IS PROVIDED “AS IS” WITH NO WARRANTIES, AND CONFERS NO RIGHTS</p>

]]></content:encoded>
			<wfw:commentRss>http://www.davidaiken.com/2011/10/04/hiding-response-headers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cloud Security Links from TechEd North America</title>
		<link>http://www.davidaiken.com/2011/05/19/cloud-security-links-from-teched-north-america/</link>
		<comments>http://www.davidaiken.com/2011/05/19/cloud-security-links-from-teched-north-america/#comments</comments>
		<pubDate>Thu, 19 May 2011 15:58:26 +0000</pubDate>
		<dc:creator>theDavidAiken</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.davidaiken.com/2011/05/19/cloud-security-links-from-teched-north-america/</guid>
		<description><![CDATA[Yesterday I had the pleasure of being the person at the front in a discussion of Cloud Security at Microsoft’s TechEd conference. Big thanks to those who came along to the last session of the day. During the discussion, I was asked for a list of links to find out more information about Microsoft’s cloud <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://www.davidaiken.com/2011/05/19/cloud-security-links-from-teched-north-america/" class="more-link"><span>Read More &#8594;</span></a></span>]]></description>
				<content:encoded><![CDATA[
<p>Yesterday I had the pleasure of being the person at the front in a discussion of Cloud Security at Microsoft’s TechEd conference. Big thanks to those who came along to the last session of the day. During the discussion, I was asked for a list of links to find out more information about Microsoft’s cloud security. This probably isn’t exhaustive, but here goes:</p>
<p>General Cloud Security including data center security:</p>
<ul>
<li><a href="http://www.globalfoundationservices.com/security/index.html">Microsoft Global Foundation Services security page</a></li>
<li><a title="Information Security Management System for Microsoft Cloud Infrastructure" href="http://www.globalfoundationservices.com/security/documents/InformationSecurityMangSysforMSCloudInfrastructure.pdf">Information Security Management System for Microsoft Cloud Infrastructure</a></li>
<li><a title="Microsoft’s  Compliance Framework for Online Services" href="http://www.globalfoundationservices.com/documents/MicrosoftComplianceFramework1009.pdf">Microsoft’s&#160; Compliance Framework for Online Services</a></li>
<li><a title="Securing Microsoft&#39;s Cloud Infrastructure" href="http://www.globalfoundationservices.com/security/documents/SecuringtheMSCloudMay09.pdf">Securing Microsoft&#8217;s Cloud Infrastructure</a></li>
<li>Webcast: <a title="Online Services Security and Compliance- Microsoft’s Compliance Framework for Online Services" href="https://www.livemeeting.com/cc/mseventsbmo/view?id=Q3HP4P&amp;role=attend&amp;pw=RT56D7W3&amp;cn=Guest&amp;recording_agreement=accepted&amp;placewarecookie+true&amp;fmt=lmm">Online Services Security and Compliance- Microsoft’s Compliance Framework for Online Services</a></li>
<li>Whiteboard Session: <a title="Online Services Security and Compliance- Microsoft’s Compliance Framework for Online Services" href="mms://msnvideo.wmod.llnwd.net/a392/d1/cmg/events/videos/6250_Str.wmv">Online Services Security and Compliance- Microsoft’s Compliance Framework for Online Services</a></li>
</ul>
<p>Office 365 Security</p>
<ul>
<li><a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=6c6ecc6c-64f5-490a-bca3-8835c9a4a2ea">Office 365 Security Service Description</a></li>
</ul>
<p>Windows Azure Platform Security</p>
<ul>
<li><a title="Windows Azure™ Security Overview" href="http://www.globalfoundationservices.com/security/documents/WindowsAzureSecurityOverview1_0Aug2010.pdf">Windows Azure™ Security Overview</a></li>
<li><a title="TechNet Webcast - Windows Azure Security - A Peek Under the Hood (Level 100)" href="http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?culture=en-US&amp;EventID=1032450967&amp;CountryCode=US">TechNet Webcast &#8211; Windows Azure Security &#8211; A Peek Under the Hood (Level 100)</a></li>
<li><a title="MSDN Webcast - Security Talk - Using Windows Azure Storage Securely (Level 200)" href="http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?culture=en-US&amp;EventID=1032450107&amp;CountryCode=US">MSDN Webcast &#8211; Security Talk &#8211; Using Windows Azure Storage Securely (Level 200)</a></li>
<li><a title="MSDN Webcast - Security Talk - Azure Federated Identity Security Using ADFS 2.0 (Level 300)" href="http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?culture=en-US&amp;EventID=1032438529&amp;CountryCode=US">MSDN Webcast &#8211; Security Talk &#8211; Azure Federated Identity Security Using ADFS 2.0 (Level 300)</a></li>
<li><a title="Security Guidelines and Limitations (SQL Azure Database)" href="http://msdn.microsoft.com/en-us/library/ff394108.aspx">Security Guidelines and Limitations (SQL Azure Database)</a></li>
<li><a title="SQL Azure Firewall" href="http://msdn.microsoft.com/en-us/library/ee621782.aspx">SQL Azure Firewall</a></li>
<li><a title="Security Best Practices for Developing Windows Azure Applications" href="http://www.globalfoundationservices.com/security/documents/SecurityBestPracticesWindowsAzureApps.pdf">Security Best Practices for Developing Windows Azure Applications</a></li>
<li><a title="http://www.microsoft.com/security/sdl/" href="http://www.microsoft.com/security/sdl/">http://www.microsoft.com/security/sdl/</a></li>
</ul>
<p>THIS POSTING IS PROVIDED “AS IS” WITH NO WARRANTIES, AND CONFERS NO RIGHTS</p>

]]></content:encoded>
			<wfw:commentRss>http://www.davidaiken.com/2011/05/19/cloud-security-links-from-teched-north-america/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Life without Email&#8211;automating the email tax</title>
		<link>http://www.davidaiken.com/2011/04/21/life-without-emailautomating-the-email-tax/</link>
		<comments>http://www.davidaiken.com/2011/04/21/life-without-emailautomating-the-email-tax/#comments</comments>
		<pubDate>Thu, 21 Apr 2011 22:11:30 +0000</pubDate>
		<dc:creator>theDavidAiken</dc:creator>
				<category><![CDATA[Thinking Out Loud]]></category>

		<guid isPermaLink="false">http://www.davidaiken.com/2011/04/21/life-without-emailautomating-the-email-tax/</guid>
		<description><![CDATA[I’ve seen a few posts this week talking about the merits of email and the handling of our seemingly overwhelming inboxes. The general consensus seems to be that we get too much email and it’s not worth our time to read and process every last one. For those battling with email, I thought I would <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://www.davidaiken.com/2011/04/21/life-without-emailautomating-the-email-tax/" class="more-link"><span>Read More &#8594;</span></a></span>]]></description>
				<content:encoded><![CDATA[
<p>I’ve seen a few posts this week talking about the merits of email and the handling of our seemingly overwhelming inboxes. The general consensus seems to be that we get too much email and it’s not worth our time to read and process every last one. </p>
<p>For those battling with email, I thought I would share my latest setup. Every few months I have a large email purge, usually forced by the “your mailbox is almost at its maximum size” email. Each time I do a purge, I try to think of a way to reduce my email tax, and automate as much as I can – using tools and techniques from GTD etc. The outcome from each purge is that I generally spend less time each day processing email, and more time actually doing the things that matter. </p>
<p>So here is what I have in place right now:</p>
<ul>
<li>Inbox has a auto archive (which just deletes) policy of 2 months. I’m working up the courage to switch to just a few days here. Honestly, if I haven’t responded, or moved the email to Action/Wait For or Someday in 72 hours, I probably won’t.</li>
<li>Sent items has 1 month auto archive policy. </li>
<li>All emails to DL’s are stored in a DL folder with a 1 week retention policy. There is one DL exception, which contains the team I support and is a mini-action item folder.</li>
<li>Action items have a 1 month retention policy.</li>
<li>Wait For &amp; Someday items have a 3 month retention policy.</li>
<li>I have a reference folder which as no retention policy as well as a business folder with a 1 year retention policy.</li>
<li>Outlook clears deleted items on exit.</li>
</ul>
<p>How do you handle your email?</p>
<p>THIS POSTING IS PROVIDED “AS IS” WITH NO WARRANTIES, AND CONFERS NO RIGHTS</p>

]]></content:encoded>
			<wfw:commentRss>http://www.davidaiken.com/2011/04/21/life-without-emailautomating-the-email-tax/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running Azure startup tasks as a real user</title>
		<link>http://www.davidaiken.com/2011/01/19/running-azure-startup-tasks-as-a-real-user/</link>
		<comments>http://www.davidaiken.com/2011/01/19/running-azure-startup-tasks-as-a-real-user/#comments</comments>
		<pubDate>Thu, 20 Jan 2011 01:40:10 +0000</pubDate>
		<dc:creator>theDavidAiken</dc:creator>
				<category><![CDATA[Windows Azure]]></category>
		<category><![CDATA[Startup Tasks]]></category>
		<category><![CDATA[Tip]]></category>

		<guid isPermaLink="false">http://www.davidaiken.com/2011/01/19/running-azure-startup-tasks-as-a-real-user/</guid>
		<description><![CDATA[In my post about enabling PowerShell. I mentioned I got blocked for a while and would explain later why and what happened. Problem: Windows Azure runs startup tasks as localsystem. Some startup tasks need to be running in the context of a user. Solution: Use the task scheduler in Windows Server to execute the command. <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://www.davidaiken.com/2011/01/19/running-azure-startup-tasks-as-a-real-user/" class="more-link"><span>Read More &#8594;</span></a></span>]]></description>
				<content:encoded><![CDATA[
<p>In my post about enabling PowerShell. I mentioned I got blocked for a while and would explain later why and what happened.</p>
<p>Problem: Windows Azure runs startup tasks as localsystem. Some startup tasks need to be running in the context of a user.</p>
<p>Solution: Use the task scheduler in Windows Server to execute the command.</p>
<p>A few people have already asked how to apply the technique to other things so here goes.</p>
<p>Lets take a look at the original startup task I was trying to execute.</p>
<div id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">netsh advfirewall firewall add rule name=<span style="color: #006080">&quot;Windows Remote Management (HTTP-In)&quot;</span> dir=<span style="color: #0000ff">in</span> action=allow service=any enable=yes profile=any localport=5985 protocol=tcp</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Powershell -Command Enable-PSRemoting -Force</pre>
<p><!--CRLF--></div>
</div>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>This doesn’t work because the powershell command “Enable-PSRemoting” doesn’t work unless it runs as an elevated user that belongs to the administrators group. Localsystem doesn’t belong to this group.</p>
<p>In my original blog post, I showed how you could enable this using winrm. But sometimes you want this something to happen when the role starts.</p>
<p>To make a task run as a user account as a startup task simply create a new task for the Windows Scheduler to execute as shown below.</p>
<div id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">netsh advfirewall firewall add rule name=<span style="color: #006080">&quot;Windows Remote Management (HTTP-In)&quot;</span> dir=<span style="color: #0000ff">in</span> action=allow service=any enable=yes profile=any localport=5985 protocol=tcp</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">net user scheduser Secr3tC0de /add</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">net localgroup Administrators scheduser /add</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">schtasks /CREATE /TN <span style="color: #006080">&quot;EnablePS-Remoting&quot;</span> /SC ONCE /SD 01/01/2020 /ST 00:00:00 /RL HIGHEST /RU scheduser /RP Secr3tC0de /TR <span style="color: #006080">&quot;powershell -Command Enable-PSRemoting -Force&quot;</span> /F</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">schtasks /RUN /TN <span style="color: #006080">&quot;EnablePS-Remoting&quot;</span></pre>
<p><!--CRLF--></div>
</div>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>Works like a charm. Hopefully you can figure out how to run your own commands instead of PowerShell.</p>
<p>It is safe to say that you probably want to secure the username and password that is created. I think ideally a wrapper that can read a username and encrypted password from config, create all the scheduled tasks and then execute them. Maybe that is a job for next time.</p>
<p>THIS POSTING IS PROVIDED “AS IS” WITH NO WARRANTIES, AND CONFERS NO RIGHTS</p>

]]></content:encoded>
			<wfw:commentRss>http://www.davidaiken.com/2011/01/19/running-azure-startup-tasks-as-a-real-user/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Enable PowerShell Remoting on Windows Azure</title>
		<link>http://www.davidaiken.com/2011/01/12/enable-powershell-remoting-on-windows-azure/</link>
		<comments>http://www.davidaiken.com/2011/01/12/enable-powershell-remoting-on-windows-azure/#comments</comments>
		<pubDate>Thu, 13 Jan 2011 05:20:00 +0000</pubDate>
		<dc:creator>theDavidAiken</dc:creator>
				<category><![CDATA[Windows Azure]]></category>
		<category><![CDATA[Azure Connect]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Startup Tasks]]></category>

		<guid isPermaLink="false">http://www.davidaiken.com/2011/01/13/enable-powershell-remoting-on-windows-azure/</guid>
		<description><![CDATA[If it takes you more than 1 line of code, you aren&#8217;t doing it right! I started writing this post a week ago in response to a customer request, so excited I was I even tweeted about writing a post on PowerShell. My Bad – because right after I tweeted I hit a snag – <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://www.davidaiken.com/2011/01/12/enable-powershell-remoting-on-windows-azure/" class="more-link"><span>Read More &#8594;</span></a></span>]]></description>
				<content:encoded><![CDATA[
<p>If it takes you more than 1 line of code, you aren&#8217;t doing it right!</p>
<p>I started writing this post a week ago in response to a customer request, so excited I was I even tweeted about writing a post on PowerShell. My Bad – because right after I tweeted I hit a snag – which is worthy of a whole post on its own. Ignoring the snag right now – let me tell you how to do the above.</p>
<p>First – a BIG shout out to the PowerShell team at Microsoft who answered my endless questions. Also a big shout out to <a href="http://www.leeholmes.com/blog/" target="_blank">Lee Holmes</a> – who once again saved my bacon.</p>
<p>Anyway…</p>
<p>At long last I’ve had a chance to “play” around with the new Windows Azure features we announced at PDC 2010. I thought it would be fun to enable PowerShell Remoting in Windows Azure Roles. (Note I’m talking about Web and Worker roles here – not VM Role).</p>
<p>With new features such as remote desktop, startup tasks and Azure Connect – setting up PowerShell should be easy.</p>
<p>First, I’m going to assume you have worked through the notes/tutorials/stuff to enable Azure Connect &amp; Remote Desktop – that way this post stays within the realms of being relatively small.</p>
<p>Here is our checklist:</p>
<ul>
<li>Make sure the OS Family in the ServiceConfiguration.cscfg is set to “2” to enable R2.&#160; </li>
<li>Create a user account so you can connect to the server. </li>
<li>Add a startup task to open the firewall port.</li>
<li>Add the Role to Azure Connect. </li>
<li>Execute Lee’s magic script to enable PowerShell Remoting</li>
</ul>
<p>PowerShell v2 is the version you need to do remoting. Server 2008 R2 contains PowerShell v2 in the box. We can tell Windows Azure to use an R2 server by changing the OSFamily in the ServiceCOnfiguration.cscfg to 2 as shown below:</p>
<div id="codeSnippetWrapper">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"><span style="color: #0000ff">&lt;</span><span style="color: #800000">ServiceConfiguration</span> <span style="color: #ff0000">serviceName</span><span style="color: #0000ff">=&quot;AzureMemcachedTest&quot;</span> <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=&quot;http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration&quot;</span> <span style="color: #ff0000">osFamily</span><span style="color: #0000ff">=&quot;2&quot;</span> <span style="color: #ff0000">osVersion</span><span style="color: #0000ff">=&quot;*&quot;</span><span style="color: #0000ff">&gt;</span><br /></pre>
<p></div>
<p>Next step is to create a user account so that you can actually connect to the server. The easiest way to do this is to enable remote desktop, which creates a user on the host.</p>
<p>Now to make sure the firewall port is open we will need. I created a .cmd file containing the following 2 commands. The first opens the firewall for WINRM, the second for ping. This was added in the root folder of my role project.</p>
<div id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">netsh advfirewall firewall add rule name=<span style="color: #006080">&quot;Windows Remote Management (HTTP-In)&quot;</span> dir=<span style="color: #0000ff">in</span> action=allow service=any enable=yes profile=any localport=5985 protocol=tcp</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">netsh advfirewall firewall add rule name=<span style="color: #006080">&quot;ICMPv6 echo&quot;</span> dir=<span style="color: #0000ff">in</span> action=allow enable=yes protocol=icmpv6:128,any</pre>
<p><!--CRLF--></div>
</div>
<p>Then I added a startup task to ServiceDefinition.csdef:</p>
<div id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">Startup</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">  <span style="color: #0000ff">&lt;</span><span style="color: #800000">Task</span> <span style="color: #ff0000">commandLine</span><span style="color: #0000ff">=&quot;EnablePowershellRemoting.cmd&quot;</span> <span style="color: #ff0000">executionContext</span><span style="color: #0000ff">=&quot;elevated&quot;</span> <span style="color: #ff0000">taskType</span><span style="color: #0000ff">=&quot;foreground&quot;</span><span style="color: #0000ff">/&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">Startup</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></div>
</div>
<p>Next add the Role to Azure Connect. I’ll assume you know how to do this.</p>
<p>Now deploy your service. Once deployed, do the final step to connect the Azure connect network, and make sure the agent is installed on your computer.</p>
<p>The final step is to “turn on” PowerShell Remoting. For numerous reasons, you cannot just run a startup task with “Enable-PSRemoting” as the command. The biggest reason is that startup tasks run as local system and thus cannot actually complete the Enable-PSRemoting command.</p>
<p>This is where I got stuck for 3 days until Lee shared his script. The script is below and is fairly easy to follow. Basically it will connect to the VM and create a scheduled task to enable-psremoting. </p>
<div id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">##############################################################################</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">##</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">## Enable-RemotePsRemoting</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">##</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">## From Windows PowerShell Cookbook (O'Reilly)</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">## by Lee Holmes (http://www.leeholmes.com/guide)</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">##</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">##############################################################################</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&lt;<span style="color: #008000">#</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">.SYNOPSIS</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Enables PowerShell Remoting on a remote computer. Requires that the machine</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">responds to WMI requests, and that its operating system is Windows Vista or</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">later.</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">.EXAMPLE</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Enable-RemotePsRemoting &lt;Computer&gt;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #008000">#&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">param</span>(</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #008000">## The computer on which to enable remoting</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    $Computername,</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #008000">## The credential to use when connecting</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    $Credential = (Get-Credential)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Set-StrictMode -Version Latest</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">$VerbosePreference = <span style="color: #006080">&quot;Continue&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">$credential = Get-Credential $credential</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">$username = $credential.Username</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">$password = $credential.GetNetworkCredential().Password</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">$<span style="color: #0000ff">script</span> = <span style="color: #006080">@&quot;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">`$log = Join-Path `$env:TEMP Enable-RemotePsRemoting.output.txt</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Remove-Item -Force `$log -ErrorAction SilentlyContinue</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Start-Transcript -Path `$log</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">## Create a task that will run with full network privileges.</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">## In this task, we call Enable-PsRemoting</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">schtasks /CREATE /TN 'Enable Remoting' /SC WEEKLY /RL HIGHEST ``</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    /RU $username /RP $password ``</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    /TR &quot;</span>powershell -noprofile -command Enable-PsRemoting -Force<span style="color: #006080">&quot; /F |</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    Out-String</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">schtasks /RUN /TN 'Enable Remoting' | Out-String</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">`$securePass = ConvertTo-SecureString $password -AsPlainText -Force</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">`$credential =</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    New-Object Management.Automation.PsCredential $username,`$securepass</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">## Wait for the remoting changes to come into effect</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">for(`$count = 1; `$count -le 10; `$count++)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">{</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    `$output = Invoke-Command localhost { 1 } -Cred `$credential ``</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        -ErrorAction SilentlyContinue</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    if(`$output -eq 1) { break; }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    &quot;</span>Attempt `$count : Not ready yet.<span style="color: #006080">&quot;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    Sleep 5</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">}</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">## Delete the temporary task</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">schtasks /DELETE /TN 'Enable Remoting' /F | Out-String</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Stop-Transcript</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">&quot;</span>@</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">$commandBytes = [System.Text.Encoding]::Unicode.GetBytes($<span style="color: #0000ff">script</span>)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">$encoded = [Convert]::ToBase64String($commandBytes)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Write-Verbose <span style="color: #006080">&quot;Configuring $computername&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">$command = <span style="color: #006080">&quot;powershell -NoProfile -EncodedCommand $encoded&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">$null = Invoke-WmiMethod -Computer $computername -Credential $credential `</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    Win32_Process Create -Args $command</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Write-Verbose <span style="color: #006080">&quot;Testing connection&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">Invoke-Command $computername {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    Get-WmiObject Win32_ComputerSystem } -Credential $credential</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
<p><!--CRLF--></div>
</div>
<p>Piece of cake really. </p>
<p>Once you have the script saved, you can execute it like</p>
<div id="codeSnippetWrapper">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">PS&gt; $computername = <span style="color: #006080">&quot;WhateverTheComputerNameOfTheInstanceIs&quot;</span><br />PS&gt; .\Enable-RemotePSRemoting.ps1 $computername<br /></pre>
<p></div>
<p>Once it finishes executing, you should be able to connect using:</p>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<div id="codeSnippetWrapper">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">PS&gt; Enter-PSSession –ComputerName $computername –Credential RemoteDesktopUsername</pre>
<p></div>
<p>Then you can work interactively – try get-process as an example.</p>
<p>Pretty neat, and great for debugging!</p>
<p>THIS POSTING IS PROVIDED “AS IS” WITH NO WARRANTIES, AND CONFERS NO RIGHTS</p>

]]></content:encoded>
			<wfw:commentRss>http://www.davidaiken.com/2011/01/12/enable-powershell-remoting-on-windows-azure/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Windows Azure Memcached plugin</title>
		<link>http://www.davidaiken.com/2011/01/11/windows-azure-memcached-plugin/</link>
		<comments>http://www.davidaiken.com/2011/01/11/windows-azure-memcached-plugin/#comments</comments>
		<pubDate>Wed, 12 Jan 2011 05:52:24 +0000</pubDate>
		<dc:creator>theDavidAiken</dc:creator>
				<category><![CDATA[Windows Azure]]></category>
		<category><![CDATA[Memcached]]></category>
		<category><![CDATA[Plugin]]></category>

		<guid isPermaLink="false">http://www.davidaiken.com/2011/01/11/windows-azure-memcached-plugin/</guid>
		<description><![CDATA[Update: Fixed broken link. Cutting a really long story short. I wanted an easy way of adding caching to a Windows Azure project. Several people I know are already using Memcached, while waiting for our own caching service to go into production. I thought, this should be a plugin. A plugin is exactly what it <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://www.davidaiken.com/2011/01/11/windows-azure-memcached-plugin/" class="more-link"><span>Read More &#8594;</span></a></span>]]></description>
				<content:encoded><![CDATA[
<p>Update: Fixed broken link.</p>
<p>Cutting a really long story short. I wanted an easy way of adding caching to a Windows Azure project. Several people I know are already using Memcached, while waiting for our own caching service to go into production. I thought, this should be a plugin.</p>
<p>A plugin is exactly what it sounds, it is something that gets “plugged” into your role at build time. You can see the existing plugins on you have installed by looking at C:\Program Files\Windows Azure SDK\v1.3\bin\plugins. You should see plugins for diagnostics, RemoteAccess and more.</p>
<p>To make your own plugin is fairly easy – if you look in any of the plugin folders you will see a .CSPLUGIN file. You should be able to work out how this works. If you cannot, you probably don’t want to be building your own.</p>
<p>For the Memcached plugin, all I really need is the memcached.exe file (and any dependencies( I used the version from <a title="http://www.urielkatz.com/archive/detail/memcached-64-bit-windows/" href="http://www.urielkatz.com/archive/detail/memcached-64-bit-windows/">http://www.urielkatz.com/archive/detail/memcached-64-bit-windows/</a>)), plus a little wrapper to read the config and launch memcached with the correct parameters – and of course the CSPLUGIN file:</p>
<pre class="code"><span style="color: blue;">&lt;?</span><span style="color: #a31515;">xml </span><span style="color: red;">version</span><span style="color: blue;">=</span>"<span style="color: blue;">1.0</span>" <span style="color: blue;">?&gt;
&lt;</span><span style="color: #a31515;">RoleModule
  </span><span style="color: red;">xmlns</span><span style="color: blue;">=</span>"<span style="color: blue;">http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition</span>"
  <span style="color: red;">namespace</span><span style="color: blue;">=</span>"<span style="color: blue;">Memcached64Plugin</span>"<span style="color: blue;">&gt;
  &lt;</span><span style="color: #a31515;">Startup</span><span style="color: blue;">&gt;
    &lt;</span><span style="color: #a31515;">Task </span><span style="color: red;">commandLine</span><span style="color: blue;">=</span>"<span style="color: blue;">Memcached64Plugin.exe</span>" <span style="color: red;">taskType</span><span style="color: blue;">=</span>"<span style="color: blue;">background</span>" <span style="color: red;">executionContext</span><span style="color: blue;">=</span>"<span style="color: blue;">limited</span>"<span style="color: blue;">/&gt;
  &lt;/</span><span style="color: #a31515;">Startup</span><span style="color: blue;">&gt;
  &lt;</span><span style="color: #a31515;">Endpoints</span><span style="color: blue;">&gt;
    &lt;</span><span style="color: #a31515;">InternalEndpoint </span><span style="color: red;">name</span><span style="color: blue;">=</span>"<span style="color: blue;">Endpoint</span>" <span style="color: red;">protocol</span><span style="color: blue;">=</span>"<span style="color: blue;">tcp</span>" <span style="color: red;">port</span><span style="color: blue;">=</span>"<span style="color: blue;">11212</span>" <span style="color: blue;">/&gt;
  &lt;/</span><span style="color: #a31515;">Endpoints</span><span style="color: blue;">&gt;
  &lt;</span><span style="color: #a31515;">ConfigurationSettings</span><span style="color: blue;">&gt;
    &lt;</span><span style="color: #a31515;">Setting </span><span style="color: red;">name</span><span style="color: blue;">=</span>"<span style="color: blue;">CacheSizeInMB</span>"<span style="color: blue;">/&gt;
  &lt;/</span><span style="color: #a31515;">ConfigurationSettings</span><span style="color: blue;">&gt;
&lt;/</span><span style="color: #a31515;">RoleModule</span><span style="color: blue;">&gt;
</span></pre>
<p>What the above essentially does is:</p>
<ol>
<li>Adds a startup task</li>
<li>Adds an InternalEndpoint for port 11212</li>
<li>Adds a CacheSizeInMb setting</li>
</ol>
<p>The little wrapper was written as a console app:</p>
<pre class="code"><span style="color: blue;">static void </span>Main()
{

    <span style="color: blue;">var </span>endpoint = <span style="color: #2b91af;">RoleEnvironment</span>.CurrentRoleInstance.InstanceEndpoints[<span style="color: #a31515;">"Memcached64Plugin.Endpoint"</span>].IPEndpoint;
    <span style="color: blue;">var </span>cacheSize = <span style="color: #2b91af;">RoleEnvironment</span>.GetConfigurationSettingValue(<span style="color: #a31515;">"Memcached64Plugin.CacheSizeInMB"</span>);
    <span style="color: blue;">var </span>startupInfo = <span style="color: blue;">new </span><span style="color: #2b91af;">ProcessStartInfo</span>(<span style="color: #a31515;">"memcached.exe"</span>, <span style="color: blue;">string</span>.Format(<span style="color: #a31515;">"-m {0} -p {1}"</span>, cacheSize, endpoint.Port));

    <span style="color: #2b91af;">Process</span>.Start(startupInfo);
}</pre>
<p>Note when we read the values we use the format <strong>&lt;name of the plugin&gt;.&lt;key&gt;</strong>, rather than just <strong>&lt;key&gt;</strong>, in this case <strong>Memcached64Plugin.Endpoint</strong>, rather than just <strong>Endpoint</strong>.</p>
<p>Once you build the solution and copy the files into the plugin folder, you can then use the Imports tag in your <em>ServiceConfiguration.csdef</em> file:</p>
<pre class="code"> <span style="color: blue;">&lt;</span><span style="color: #a31515;">Import </span><span style="color: red;">moduleName</span><span style="color: blue;">=</span>"<span style="color: blue;">Memcached64Plugin</span>" <span style="color: blue;">/&gt;
</span></pre>
<p>This will magically add the correct settings to your ServiceConfiguration.cscfg file as shown:</p>
<pre class="code">    <span style="color: blue;">&lt;</span><span style="color: #a31515;">ConfigurationSettings</span><span style="color: blue;">&gt;
      &lt;</span><span style="color: #a31515;">Setting </span><span style="color: red;">name</span><span style="color: blue;">=</span>"<span style="color: blue;">Memcached64Plugin.CacheSizeInMB</span>" <span style="color: red;">value</span><span style="color: blue;">=</span>"<span style="color: blue;">512</span>" <span style="color: blue;">/&gt;
</span></pre>
<p>Note, you won’t see the internal port or the startup task.</p>
<p>When you build and deploy (or even run in the Compute Emulator) the plugin will be packaged up with your code and executed on boot.</p>
<p>For the client side, I used the enyim client, which you can grab from <a title="http://memcached.enyim.com/" href="http://memcached.enyim.com/">http://memcached.enyim.com/</a>.</p>
<p>You can grab a list of memcached servers using the RoleEnvironment, something like:</p>
<pre class="code"><span style="color: #2b91af;">RoleEnvironment</span>.Roles[<span style="color: #a31515;">"WebRole1"</span>].Instances.Select(instance =&gt; instance.InstanceEndpoints[<span style="color: #a31515;">"Memcached64Plugin.Endpoint"</span>].IPEndpoint)</pre>
<p>Note the role is WebRole1 and the port we are looking for is the one we defined in the CSPLUGIN!</p>
<p>You should also write some code to handle a topology change, including adding more instances (or removing instances). You can do this by adding code to handle the RoleEnvironment.Changed event, and rebuilding your server list.</p>
<p>You can grab my plugin below, minus the memcached.exe and required dll. You can download those from the <a title="http://www.urielkatz.com/archive/detail/memcached-64-bit-windows/" href="http://www.urielkatz.com/archive/detail/memcached-64-bit-windows/">http://www.urielkatz.com/archive/detail/memcached-64-bit-windows/</a>.</p>
<p><iframe title ="Preview" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" style="width:98px;height:115px;padding:0;background-color:#fcfcfc;" src="http://cid-e3e276dbb809762b.office.live.com/embedicon.aspx/Public/Memcached64Plugin.rar"></iframe></p>
<p>THIS POSTING IS PROVIDED “AS IS” WITH NO WARRANTIES, AND CONFERS NO RIGHTS</p>
<p>PS: No, this was nothing to do with PowerShell, I hit an issue with that which I’m still working on – cross your fingers – it will be splendid.</p>

]]></content:encoded>
			<wfw:commentRss>http://www.davidaiken.com/2011/01/11/windows-azure-memcached-plugin/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Windows Azure Diagnostics Viewer</title>
		<link>http://www.davidaiken.com/2010/11/09/windows-azure-diagnostics-viewer/</link>
		<comments>http://www.davidaiken.com/2010/11/09/windows-azure-diagnostics-viewer/#comments</comments>
		<pubDate>Tue, 09 Nov 2010 15:55:12 +0000</pubDate>
		<dc:creator>theDavidAiken</dc:creator>
				<category><![CDATA[Windows Azure]]></category>
		<category><![CDATA[Code Gallery]]></category>
		<category><![CDATA[Diagnostics Viewer]]></category>

		<guid isPermaLink="false">http://www.davidaiken.com/2010/11/09/windows-azure-diagnostics-viewer/</guid>
		<description><![CDATA[I’ve just finished publishing a prototype of the Windows Azure Diagnostics Viewer onto code gallery at http://code.msdn.microsoft.com/wazdmon. The Windows Azure Diagnostics Viewer is a prototype web application that can be used to view and analyze Windows Azure Diagnostics information. The Windows Azure Diagnostics Viewer has 2 components, a website and a scheduler. The website provides <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://www.davidaiken.com/2010/11/09/windows-azure-diagnostics-viewer/" class="more-link"><span>Read More &#8594;</span></a></span>]]></description>
				<content:encoded><![CDATA[
<p>I’ve just finished publishing a prototype of the Windows Azure Diagnostics Viewer onto code gallery at <a href="http://code.msdn.microsoft.com/wazdmon">http://code.msdn.microsoft.com/wazdmon</a>. </p>
<p>The Windows Azure Diagnostics Viewer is a prototype web application that can be used to view and analyze Windows Azure Diagnostics information. </p>
<p><a href="http://www.davidaiken.com/wp-content/uploads/2010/11/image.png" target="_blank"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="Windows Azure Diagnostics Monitor Screenshot" border="0" alt="Windows Azure Diagnostics Monitor Screenshot" src="http://www.davidaiken.com/wp-content/uploads/2010/11/image_thumb.png" width="590" height="299" /></a></p>
<p>The Windows Azure Diagnostics Viewer has 2 components, a website and a scheduler. The website provides a UI to allow you to view diagnostics information collected by Windows Azure, including performance counter graphs, logs as well as some customer data including Windows Azure Queue statistics and service status data.</p>
<p>The website is designed to be “injected” into an existing worker role by adding references to a few dll’s as well as the website “exe”. The goal here is to make adding the viewer to a project painless – although in the prototype there are still several steps to complete.</p>
<p>Once started, the viewer website uses the HWC to host the website.</p>
<p>As well as simply viewing data collected by the existing Windows Azure Diagnostics system, the viewer can also display pre-aggregated data as well as information about Queue lengths and even service status. It does this with the help of the scheduler.</p>
<p>The scheduler is also designed to be “injected” into a role, and simply executes specified tasks. These tasks are contained in dll’s which are loaded from blob storage. The viewer provides shortcuts to common tasks, such as queue length collection and data aggregation.</p>
<p>Whilst this is a prototype, it has inspired some other thinking and ideas. You can expect a rev for the new SDK shortly after the new SDK hits as we’d like to take advantage of some of the new SDK features.</p>
<p>Anyway, check it out and let us know what you think.</p>
<p>THIS POSTING IS PROVIDED “AS IS” WITH NO WARRANTIES, AND CONFERS NO RIGHTS</p>

]]></content:encoded>
			<wfw:commentRss>http://www.davidaiken.com/2010/11/09/windows-azure-diagnostics-viewer/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Fabrikam Shipping SaaS Sample</title>
		<link>http://www.davidaiken.com/2010/10/08/fabrikam-shipping-saas-sample/</link>
		<comments>http://www.davidaiken.com/2010/10/08/fabrikam-shipping-saas-sample/#comments</comments>
		<pubDate>Fri, 08 Oct 2010 16:04:36 +0000</pubDate>
		<dc:creator>theDavidAiken</dc:creator>
				<category><![CDATA[Windows Azure]]></category>
		<category><![CDATA[Demo]]></category>
		<category><![CDATA[SaaS]]></category>

		<guid isPermaLink="false">http://www.davidaiken.com/2010/10/08/fabrikam-shipping-saas-sample/</guid>
		<description><![CDATA[My good friend Vittorio Bertocci has just posted a new demo that shows how you can build multi-tenant applications on Windows Azure called Fabrikam Shipping. FabrikamShipping SaaS is a complete subscription based solution running on the Windows Azure platform and publicly available thru www.fabrikamshipping.com. It offers a web-based customer onboarding UI, which anybody can use <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://www.davidaiken.com/2010/10/08/fabrikam-shipping-saas-sample/" class="more-link"><span>Read More &#8594;</span></a></span>]]></description>
				<content:encoded><![CDATA[
<p>My good friend Vittorio Bertocci has just posted a new demo that shows how you can build multi-tenant applications on Windows Azure called Fabrikam Shipping.</p>
<p><a href="http://www.fabrikamshipping.com/">FabrikamShipping SaaS</a> is a complete subscription based solution running on the Windows Azure platform and publicly available thru <a href="http://www.fabrikamshipping.com">www.fabrikamshipping.com</a>. It offers a web-based customer onboarding UI, which anybody can use for creating test subscriptions and obtain their very own application instance, dynamically provisioned by a simple but powerful provisioning engine. Thanks to our partnership with our friends evangelists at <a href="https://www.x.com/index.jspa">PayPal</a>, it even demonstrates how to integrate payments and billing via an external provider!</p>
<p>Find out more at Vittorio’s blog &#8211; <a title="http://blogs.msdn.com/b/vbertocci/archive/2010/10/07/new-online-demo-introducing-fabrikamshipping-saas.aspx" href="http://blogs.msdn.com/b/vbertocci/archive/2010/10/07/new-online-demo-introducing-fabrikamshipping-saas.aspx">http://blogs.msdn.com/b/vbertocci/archive/2010/10/07/new-online-demo-introducing-fabrikamshipping-saas.aspx</a>.</p>
<p>THIS POSTING IS PROVIDED “AS IS” WITH NO WARRANTIES, AND CONFERS NO RIGHTS</p>

]]></content:encoded>
			<wfw:commentRss>http://www.davidaiken.com/2010/10/08/fabrikam-shipping-saas-sample/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Updated Windows Azure Training Kit</title>
		<link>http://www.davidaiken.com/2010/10/05/updated-windows-azure-training-kit/</link>
		<comments>http://www.davidaiken.com/2010/10/05/updated-windows-azure-training-kit/#comments</comments>
		<pubDate>Tue, 05 Oct 2010 15:15:03 +0000</pubDate>
		<dc:creator>theDavidAiken</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.davidaiken.com/2010/10/05/updated-windows-azure-training-kit/</guid>
		<description><![CDATA[Yesterday my old team (yes I’ve changed jobs), released the latest version of the Windows Azure platform training kit. The kit is now in 2 versions, one for vs2008 developers and one for 2010 developers. You can download the kit from http://www.microsoft.com/downloads/en/details.aspx?FamilyID=413E88F8-5966-4A83-B309-53B7B77EDF78&#38;displaylang=en. Here is what is new in the training kit: Updated all hands-on labs <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://www.davidaiken.com/2010/10/05/updated-windows-azure-training-kit/" class="more-link"><span>Read More &#8594;</span></a></span>]]></description>
				<content:encoded><![CDATA[
<p>Yesterday my old team (yes I’ve changed jobs), released the latest version of the Windows Azure platform training kit. The kit is now in 2 versions, one for vs2008 developers and one for 2010 developers. You can download the kit from <a title="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=413E88F8-5966-4A83-B309-53B7B77EDF78&amp;displaylang=en" href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=413E88F8-5966-4A83-B309-53B7B77EDF78&amp;displaylang=en">http://www.microsoft.com/downloads/en/details.aspx?FamilyID=413E88F8-5966-4A83-B309-53B7B77EDF78&amp;displaylang=en</a>. </p>
<p>Here is what is new in the training kit: </p>
<ul>
<li>Updated all hands-on labs and demo scripts for Visual Studio 2010, the .NET Framework 4, and the Windows Azure Tools for Visual Studio version 1.2 release </li>
<li>Added a new hands-on lab titled &quot;Introduction to the AppFabric Access Control Service (September 2010 Labs Release)&quot; </li>
<li>Added a new hands-on lab &quot;Debugging Applications in Windows Azure&quot; </li>
<li>Added a new hands-on lab &quot;Asynchronous Workload Handling&quot; </li>
<li>Added a new exercise to the &quot;Deploying Applications in Windows Azure&quot; hands-on lab to show how to use the new tools to directly deploy from Visual Studio 2010. </li>
<li>Added a new exercise to the &quot;Introduction to the AppFabric Service Bus&quot; hands-on lab to show how to connect a WCF Service in IIS 7.5 to the Service Bus </li>
<li>Updated the &quot;Introduction to AppFabric Service Bus&quot; hands-on lab based on feedback and split the lab into 2 parts </li>
<li>All of the presentations have also been updated and refactored to provide content for a 3 day training workshop. </li>
<li>Updated the training kit navigation pages to include a 3 day agenda, a change log, and an improved setup process for hands-on labs. </li>
</ul>
<p>So go download the kit right now and keep your skills sharp.</p>
<p>THIS POSTING IS PROVIDED “AS IS” WITH NO WARRANTIES, AND CONFERS NO RIGHTS</p>

]]></content:encoded>
			<wfw:commentRss>http://www.davidaiken.com/2010/10/05/updated-windows-azure-training-kit/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Manage Your SQL Azure databases with Project Houston</title>
		<link>http://www.davidaiken.com/2010/07/21/manage-your-sql-azure-databases-with-project-houston/</link>
		<comments>http://www.davidaiken.com/2010/07/21/manage-your-sql-azure-databases-with-project-houston/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 22:45:21 +0000</pubDate>
		<dc:creator>theDavidAiken</dc:creator>
				<category><![CDATA[SQL Azure]]></category>
		<category><![CDATA[Project Houston]]></category>

		<guid isPermaLink="false">http://www.davidaiken.com/2010/07/21/manage-your-sql-azure-databases-with-project-houston/</guid>
		<description><![CDATA[If you are working with SQL Azure at all and want to do some database management tasks, it’s always been a bit of a pain to have to download and install some SQL management tools. Project Houston is the answer. Here is what the product team have to say about it: Microsoft® Project Code-Named “Houston” <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://www.davidaiken.com/2010/07/21/manage-your-sql-azure-databases-with-project-houston/" class="more-link"><span>Read More &#8594;</span></a></span>]]></description>
				<content:encoded><![CDATA[
<p>If you are working with SQL Azure at all and want to do some database management tasks, it’s always been a bit of a pain to have to download and install some SQL management tools.</p>
<p>Project Houston is the answer. Here is what the product team have to say about it:</p>
<blockquote><p>Microsoft® Project Code-Named “Houston” is a lightweight and easy to use database management tool for SQL Azure databases. It is designed specifically for Web developers and other technology professionals seeking a straightforward solution to quickly develop, deploy, and manage their data-driven applications in the cloud. Project “Houston” provides a web-based database management tool for basic database management tasks like authoring and executing queries, designing and editing a database schema, and editing table data. <b>It is now available on <a href="https://www.sqlazurelabs.com/">SQL Azure Labs</a>.</b></p>
</blockquote>
<p>If you follow the link, then click on the CTP link, you will be presented with the following login screen.</p>
<p><a href="http://www.davidaiken.com/wp-content/uploads/2010/07/image7.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.davidaiken.com/wp-content/uploads/2010/07/image_thumb7.png" width="437" height="333" /></a> </p>
<p>Grab the details from the <a href="http://sql.azure.com">http://sql.azure.com</a> portal and feed them in and bask in the awesomeness that is Houston. </p>
<p><a href="http://www.davidaiken.com/wp-content/uploads/2010/07/image8.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.davidaiken.com/wp-content/uploads/2010/07/image_thumb8.png" width="644" height="349" /></a> </p>
<p>From here you can create tables, views, stored procedures, create and execute queries. It even has a cube you can spin around.</p>
<p>THIS POSTING IS PROVIDED “AS IS” WITH NO WARRANTIES, AND CONFERS NO RIGHTS</p>

]]></content:encoded>
			<wfw:commentRss>http://www.davidaiken.com/2010/07/21/manage-your-sql-azure-databases-with-project-houston/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 0.570 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2013-06-19 00:23:17 -->
