Steve Spencer's Blog

Blogging on Azure Stuff

August Windows Azure Tools Release

A new release of the Windows Azure Tools for Visual Studio 2010 is available here

The release adds the following features:

  • Profile applications running in Windows Azure.
  • Create ASP.Net MVC3 Web Roles.
  • Manage multiple service configurations in one cloud project.
  • Improved validation of Windows Azure packages.

The Windows Azure Platform Training Kit has also be updated in line with this release. It can be downloaded from here. The training kit has the following changes:

  • [Updated] Labs and Demos to leverage the August 2011 release of the Windows Azure Tools for Microsoft Visual Studio 2010
  • [Updated] Windows Azure Deployment to use the latest version of the Azure Management Cmdlets
  • [Updated] Exploring Windows Azure Storage to support deleting snapshots
  • Applied several minor fixes in content

Using Azure Storage SDK outside of Azure

When trying to access the Azure Storage SDK in a non-Azure application I kept getting the following error:

 

“The type or namespace name 'WindowsAzure' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)    “

 

References to Microsoft.WindowsAzure.ServiceRuntime and Microsoft.WindowsAzure.StorageClient were both already included as references to the assembly that was trying to store data in a table. After a bit of investigation the reason for the error was that the assembly was set to have the target framework of “.Net Framework 4 Client Profile”. Changing to “.Net Framework 4” solved the problem.

Windows Azure Roles Fail to run when deployed to Azure

Recently I was helping out at the Azure Bootcamp in London and during the labs a common theme kept occurring when the labs were deployed to a real Azure account. The roles failed to run and it appeared that the deployment was taking forever.  This is something I experienced first hand when I was starting out with Azure. There is a way to diagnosing these deployment errors and it is by using IntelliTrace. During deployment you can enable IntelliTrace as part of the publish dialog

image

The IntelliTrace option is only available if you have Visual Studio 2010 Ultimate. Once deployed to Azure the Roles will attempt to start and any errors during this phase will lead to the symptoms mentioned above. You can then connect to your Azure environment using the Server Explorer in Visual Studio to retrieve the IntelliTrace files which can be opened in Visual Studio and show any exceptions that may have been thrown. Further information can be found here. Once you have diagnosed your issue please ensure at you then disable the IntelliTrace by redeploying the fixed application as it will have a negative impact on performance if left enabled.

 

Getting back to the problem we have at the Bootcamp, the issues was that the deployed application was trying to writing information to Azure storage and the connection string was still pointing to Development storage. This was strange because none of the deployed applications had got to the Azure storage part of the lab so you would have thought that there was no need for a connection string. Luckily I had the exact same problem with one of my earlier deployments and it turns out that when a project is created the Diagnostic plug-in is automatically enabled. The diagnostic plug-in requires its own connection string to Azure storage so that the diagnostic information can be stored. Looking at the role configuration in Visual Studio you can see the Diagnostic plug-in configuration.

image

To fix the deployment issue click the button next to the connection string text box and enter the details of your Azure Storage account.

image

You will need to redeploy the application or upload the new ServiceConfiguration.cscfg to fix this issue. If this still does not resolve the issue then try disabling the Diagnostics plug-in and redeploy.

Windows Azure SDK 1.4 released

The Windows Azure SDK 1.4 refresh is available which adds in Web Deploy integration. This allows the developers to increase their productivity by using web deploy rather than having to repackage and redeploy the application. It is available for down load here and click the “Get Tools & SDK” button. Further information on this release can be found here

MSDN subscribers now get more Windows Azure Platform benefits

If you are an MSDN subscriber (Ultimate or Premium) you now get more Windows Azure resources. Professional subscribers are now also included in the promotion.

See here for more details. If you have already taken up this offer and you are an MSDN Premium subscriber then you will automatically be upgraded to the MSDN Ultimate offer.

 

In order to activate your benefits

  • Sign-in to your MSDN benefits page
  • Click on the Windows Azure Platform link from My Account and follow the steps to activate Windows Azure (for limited free access). You'll need your credit card or follow the Steps to set up invoicing for Windows Azure to sign up. If you use more than the amount of services included with your MSDN subscription, you will be billed to your card for these overages. You can visit the Microsoft Online Services Customer Portal to look up your usage at any time.
  • Go to the Windows Azure Developer Portal to access your Windows Azure subscription
  • Windows Azure AppFabric Access Control and Cache Services Commercial Release

    The first production version of the windows Azure caching service and a new production version of the Access Control service have been released. The following link provides the necessary information

    http://blogs.msdn.com/b/windowsazureappfabric/archive/2011/04/11/announcing-the-commercial-release-of-windows-azure-appfabric-caching-and-access-control.aspx

    In conjunction the Windows Azure Platform Training Kit and the Identity Developer Training Kit have both also been updated.

     

    The Windows Azure Platform Training Kits adds some new labs:

  • Authenticating Users in a Windows Phone 7 App via ACS, OData Services and Windows Azure lab
  • Windows Azure Traffic Manager lab
  • Introduction to SQL Azure Reporting Services lab
  • Azure SDK 1.4 Released

    The Azure SDK has been released and is available here

    The changes are as follows:

    • Resolved an issue that caused full IIS fail when the web.config file was set to read-only.
    • Resolved an issue that caused full IIS packages to double in size when packaged.
    • Resolved an issue that caused a full IIS web role to recycle when the diagnostics store was full.
    • Resolved an IIS log file permission Issue which caused diagnostics to be unable to transfer IIS logs to Windows Azure storage.
    • Resolved an issue preventing csupload to run on x86 platforms.
    • User errors in the web.config are now more easily diagnosable.
    • Enhancements to improve the stability and robustness of Remote Desktop to Windows Azure Roles.

    One of the changes fixes the issue I blogged in CommunicationObjectFaultedException after checking an Azure project in to TFS

    What is classed as a Storage transaction for billing purposes in Windows Azure?

    The simple answer is that each REST call made to the Azure Storage Service is counted as a single transaction. This means that each time you query your table or check the size of a queue or upload a blob you will call the Azure Storage REST api and it will be classed as a transaction. It also means that if you are doing a full table query and you start to get continuation tokens you will get multiple transactions.

    For a fuller description see the following blog post:

    http://blogs.msdn.com/b/windowsazurestorage/archive/2010/07/09/understanding-windows-azure-storage-billing-bandwidth-transactions-and-capacity.aspx

    Add your own Claims to your ADFS Provider

    Following on from my previous blog on “Creating your own identity provider …” The following changes can be made to add in your own claims.

    Firstly in the App_Data\CustomSecurityTokenService.cs file of your identity provider web site I changed the following code

    outputIdentity.Claims.Add( new Claim( System.IdentityModel.Claims.ClaimTypes.Name, principal.Identity.Name ) );
    if (principal.Identity.Name.Equals("Steve") == true)
    {
    outputIdentity.Claims.Add(new Claim(ClaimTypes.Role, "Administrator"));

    outputIdentity.Claims.Add(new Claim("http://schemas.BlackMarble/Identity/Claims/Business",
    "Black Marble"));

    }
    else
    {
    outputIdentity.Claims.Add(new Claim(ClaimTypes.Role, "User"));
    }

     

     
    The first parameter of the Claim constructor needs to be in the format of a namespace and I added this one up as it was an internal name we are using.
    The second parameter of the Claim constructor is the value you want to pass through.
     
    Next go to the appfabric portal and add in the following rule to your STS provider. You need to make sure that the schema string you have in your code matches the Input Claim Type you added in your rule.
     
     
     
    image
    Now you should be passing through the Business claim to your website. To get access to the claim use the following code:
     
    using System.Threading;
    using Microsoft.IdentityModel.Claims;
    IClaimsPrincipal principal = (IClaimsPrincipal)Thread.CurrentPrincipal;
    var business = "";
    foreach (Claim claim in principal.Identities[0].Claims)
    {
    if (claim.ClaimType.Equals("http://schemas.BlackMarble/Identity/Claims/Business"))
    {
    business = claim.Value;
    break;
    }
    }

    if (!String.IsNullOrEmpty(business))
    {
    // we have a claim value for School so lets display it
    BusinessLabel.Text = business;
    }
    else
    {
    BusinessLabel.Text = "No business claim found";
    }
    Again, note that the claim type namespace is the same as you specified previously.

    The following claims are passed through to my website:

    image