Configuring external startup tasks on an Azure cloud service

PaaSTaskWindows Azure cloud services support startup tasks to perform operations before a role starts, like installing a component, enabling a Windows feature, register a COM component, etc. by using .cmd files or just running Powershell scripts. The documentation for running startup tasks in Windows Azure is available on MSDN.

They are really powerful to setup things needed by your role. Since the startup tasks are packaged in your cloud service, the problem comes when you want to use the same cloud service for hundreds of deployments, and you need to customize at least some of these startup tasks per deployment. Or you just simply want to customize the startup tasks without rebuilding and/or redeploying your cloud service.

After thinking on different approaches to implement this scenario without adding more complexity to the application lifecycle management, a good way of doing it would be to have the opportunity to specify startup tasks on a location outside the cloud service package. In summary, to have a startup task that downloads a set of external startup tasks from an Uri and executes them in order.

Let’s see how this can be achieved.

You can download the example code from this Url: http://sdrv.ms/1dY86lt

Adding a startup task to download external startup tasks

ExternalStartupTasksIn the attached example, there is a solution containing a worker role and a cloud service project. The main aspects of this implementations are in the files:

  • ServiceDefinition.csdef
  • ServiceConfiguration.*.cscfg
  • WorkerRole.cs
  • scripts/SetupExternalTasks.cmd
  • scripts/SetupExternalTasks.ps1

Let’s check one by one to fully understand how this works.

ServiceDefinition.csdef

In the service definition file (ServiceDefinition.csdef), what we are going to do is to specify a new startup task as follows:

    <Startup>
      <Task executionContext="elevated" commandLine="scriptsSetupExternalTasks.cmd" taskType="simple">
        <Environment>
          <Variable name="EMULATED">
            <RoleInstanceValue xpath="/RoleEnvironment/Deployment/@emulated" />
          </Variable>
          <Variable name="EXTERNALTASKURL">
            <RoleInstanceValue xpath="/RoleEnvironment/CurrentInstance/ConfigurationSettings/ConfigurationSetting[@name='Startup.ExternalTasksUrl']/@value" />
          </Variable>
        </Environment>
      </Task>
    </Startup>

The startup task executes a script located on “scripts/SetupExternalTasks.cmd” in “simple” mode (the worker role OnStart event will not occur until the task completes, but you can change this behavior by modifying this attribute or by adding another task with the desired taskType). Two variables are passed:

  • EMULATED: to check if the task is being executed on the emulator or on Azure;
  • EXTERNALTASKURL: the Url of a zip file containing the external startup tasks;

ServiceConfiguration.cscfg

This Url is configured in the ServiceConfiguration.*.cscfg files as any other setting:

Settings

WorkerRole.cs

As the startup tasks are executed before the role starts, any change on this setting would recycle the role to execute them again. The following code just do this:

        public override bool OnStart()
        {
            // Set the maximum number of concurrent connections 
            ServicePointManager.DefaultConnectionLimit = 12;

            // For information on handling configuration changes
            // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.

            // Setup OnChanging event
            RoleEnvironment.Changing += RoleEnvironmentOnChanging;

            return base.OnStart();
        }

        /// <summary>
        /// This event is called after configuration changes have been submited to Windows Azure but before they have been applied in this instance
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="RoleEnvironmentChangingEventArgs" /> instance containing the event data.</param>
        private void RoleEnvironmentOnChanging(object sender, RoleEnvironmentChangingEventArgs e)
        {
            // Implements the changes after restarting the role instance
            foreach (RoleEnvironmentConfigurationSettingChange settingChange in e.Changes.Where(x => x is RoleEnvironmentConfigurationSettingChange))
            {
                switch (settingChange.ConfigurationSettingName)
                {
                    case "Startup.ExternalTasksUrl":
                        Trace.TraceWarning("The specified configuration changes can't be made on a running instance. Recycling...");
                        e.Cancel = true;
                        return;
                }
            }
        }

scripts/SetupExternalTasks.cmd

Now let’s take a look to the task that is executed at the beginning. The variables are checked to skip this setup if you are running on a development environment –you may want to remove/comment the first line- or if the Url setting is empty:

if "%EMULATED%"=="true" goto SKIP
if "%EXTERNALTASKURL%"=="" goto SKIP

cd %ROLEROOT%approotscripts
md %ROLEROOT%approotscriptsexternal

reg add HKLMSoftwareMicrosoftPowerShell1ShellIdsMicrosoft.PowerShell /v ExecutionPolicy /d Unrestricted /f
powershell .SetupExternalTasks.ps1 -tasksUrl "%EXTERNALTASKURL%" >> ExternalTasks.log 2>> ExternalTasks_err.log

:SKIP
EXIT /B 0

Then a folder “external” is created to store all the downloaded stuff inside, to don’t interfere with other scripts in the solution while downloading. Finally the powershell script is called with the Url as parameter. Both standard and error outputs are redirected to log files.

scripts/SetupExternalTasks.ps1

Finally, the powershell script that does all the work is called. Note that the script supports three types of external files: a “.cmd” file; a “.ps1” file; or a “.zip” file that can contain one or more startup tasks:

 param (
    [string]$tasksUrl = $(throw "-taskUrl is required."),
    [string]$localFolder = ""
 )

# Function to unzip file contents
function Expand-ZIPFile($file, $destination)
{
    $shell = new-object -com shell.application
    $zip = $shell.NameSpace($file)
    foreach($item in $zip.items())
    {
        # Unzip the file with 0x14 (overwrite silently)
        $shell.Namespace($destination).copyhere($item, 0x14)
    }
}

# Function to write a log
function Write-Log($message) {
    $date = get-date -Format "yyyy-MM-dd HH:mm:ss"
    $content = "`n$date - $message"
    Add-Content $localfolderSetupExternalTasks.log $content
}

 if ($tasksUrl -eq "") {
    exit
 }

if ($localFolder -eq "") {
    $localFolder = "$pwdExternal"
}

# Create folder if does not exist
Write-Log "Creating folder $localFolder"
New-Item -ItemType Directory -Force -Path $localFolder
cd $localFolder


$file = "$localFolderExternalTasks.cmd"

 if ($tasksUrl.ToLower().EndsWith(".zip")) {
    $file = "$localFolderExternalTasks.zip"
 }
 if ($tasksUrl.ToLower().EndsWith(".ps1")) {
    $file = "$localFolderExternalTasks.ps1"
 }

# Download the tasks file
Write-Log "Downloading external file $file"
$webclient = New-Object System.Net.WebClient
$webclient.DownloadFile($tasksUrl,$file)

Write-Log "Download completed"

# If the tasks are zipped, unzip them first
 if ($tasksUrl.ToLower().EndsWith(".zip")) {
    Write-Log "Unzipping $localFolderExternalTasks.zip"
    Expand-ZIPFile -file "$localFolderExternalTasks.zip" -destination $localFolder
    Write-Log "Unzip completed"

    # When a .zip file is specied, only files called "Task???.cmd" and "Task???.ps1" will be executed
    # This allows to include assemblies and other file dependencies in the zip file
    Get-ChildItem $localFolder | Where-Object {$_.Name.ToLower() -match "task[0-9][0-9][0-9].[cmd|ps1]"} | Sort-Object $_.Name | ForEach-Object {
        Write-Log "Executing $localfolder$_"        
        if ($_.Name.ToLower().EndsWith(".ps1")) {
            powershell.exe "$localFolder$_"
        }
        elseif ($_.Name.ToLower().EndsWith(".cmd")) {
            cmd.exe /C "$localFolder$_"
        }
    }
 }
 elseif ($tasksUrl.ToLower().EndsWith(".ps1")) {
    powershell.exe $file
 }
 elseif ($tasksUrl.ToLower().EndsWith(".cmd")) {
    cmd.exe /C $file
 }

 Write-Log "External tasks execution finished"

In the case of a “.zip” file, the scripts expects the startup tasks with the name “Task???.cmd” or “Task???.ps1”, and executes them in order. Note that you can package file dependencies in the zip file such as .msi files, assemblies, other .cmd/.ps1 files, etc. and only the tasks with this pattern will be called by the script.

Seeing it in action

The attached example downloads an external .zip file located at https://davidjrh.blob.core.windows.net/public/code/ExternalTaskExample.zip. This .zip file contains two tasks “Task001.cmd” and “Task002.cmd”. After starting the role, we can verify that in the “scripts” subfolder the following files are created:

FilesCreated

The “ExternalTasks_err.log” is empty (0Kb in size), indicating that the execution was successful. We can open the “ExternalTasks.log” to verify that our tasks executed as expected. In this case, the tasks are simply showing some echoes:

TasksLog

Inside the “external” subfolder we can found all the downloaded .zip file, the unzipped contents and another log about the downloading and task processing steps:

ExternalTasks

SetupTasksLog

What if I need to get a configuration setting value from an external task?

In the case you need to get a service configuration value from a external task, you can use the awesome power of combining Powershell with managed code. The following Powershell function allows you to get a configuration setting value from inside your external startup in a .ps1 file:

[void] [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.WindowsAzure.ServiceRuntime")

function Get-ConfigurationSetting($key, $defaultValue = "")
{
    if ([Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment]::IsAvailable)
    {
        return [Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment]::GetConfigurationSettingValue($key)
    }
    return $defaultValue
}

Once you have defined the function, you can use it with the following syntax. Note that the second parameter for the default value is optional.

$mySetting = Get-ConfigurationSetting "SettingName" "myDefaultValue"

Conclusion

Downloading and executing external startup tasks increase the versatility of the role startup tasks since you don’t need to repackage and upload your cloud services to change the behavior. By simply changing a setting they are automatically downloaded and executed previous starting the worker role.

You can download the example code from this Url: http://sdrv.ms/1dY86lt

Un saludo & Happy Coding!

[Evento] ¡Construye la mejor App y llévate un AR Drone 2.0!

LaGuerraDeLosDrones_Logo_WhiteAtención a la última frikada que estamos organizando a nivel nacional entre todas las comunidades técnicas de Microsoft. Se trata de un concurso de desarrollo de aplicaciones para Windows Phone y Windows RT con el objetivo de controlar remotamente drones AR Drone 2.0 de Parrot.

Partiendo del SDK que ofrece Parrot, de código open source disponible en GitHub y de todo el SDK de desarrollo para Visual Studio, los desarrolladores de las mejores 9 apps serán obsequiados con un AR Drone 2.0. En este enlace puedes encontrar las bases del concurso.

drone

Durante las próximas semanas comenzarán en cada una de las ciudades una serie de formaciones técnicas GRATUITAS sobre cómo programar tu aplicación. De hecho, los drones ya están en las sedes de cada comunidad para que puedas realizar las pruebas oportunas. En la web del concurso puedes informarte acerca de todos los eventos transcurrirán próximamente.

Así que ya sabes: piensa en una idea, ven a las sesiones para aprender cómo desarrollarla, publícala y gana tu AR Drone 2.0.

¿Friki? Ya verás los videos que vamos a ir colgando…

…¿alguien dijo drones recibiendo señales desde un servidor en Windows Azure?

EvoqContentAgradecer a DNN Corp. por la instancia de Evoq Content in the Cloud, que permiten alojar la web actual del concurso.

http://www.laguerradelosdrones.com/

 

Evento en TenerifeDev

Titulo: Desarrollando apps de control de AR.Drones en Windows Phone y Windows 8
Descripción: aprende a desarrollar aplicaciones para dispositivos móviles de plataforma Windows y compite con otros equipos a nivel nacional a ver quien construye la app más innovadora. En esta sesión se realizara una introducción al desarrollo de ambas plataformas, centrándonos finalmente en un ejemplo de app para el AR.Drone con el SDK. Veremos en directo como depurar línea a línea de código mientras el cuadricóptero revolotea por la sala. Anímate, forma un equipo, implementa tu idea, y hazte con uno de los 9 drones que hay de premio a las mejores apps.

LogoFecha: 8 de Noviembre de 2013
Hora: 17:00
Lugar: Sala de Grados de la ETSII, La Laguna
Inscripción gratuita pero por razones de aforo es necesario registrarse previamente
URL de registro al evento: http://bit.ly/TenerifeDevDrones
Organiza: TenerifeDev (http://www.tenerifedev.com) – Alberto Díaz, Jose Fortes, Santiago Porras, David Rodriguez

La dirección de la ETSII, recuerda a aquellos alumnos interesados en participar en este evento, que los estatutos de la Universidad de La Laguna (Art. 1.3, Art. 99),  establecen que la ULL "está al servicio del desarrollo integral de los pueblos, de la paz y de la defensa del medio ambiente" y que "en ningún caso se fomentará la investigación en aspectos específicamente bélicos o militaristas" por lo que la ETSII no apoyará proyectos fuera de estas directrices. Entendemos que las aplicaciones de los drones pueden ser útiles en muchos otros aspectos, por lo que animamos a los alumnos interesados a participar en proyectos ligados a las funciones que los estatutos establecen para la Universidad.

Welcome OS Family 4: Windows Server 2012 R2, IIS 8.5 and .NET Framework 4.5.1

logo-net-451This week has been an awesome one for those using Windows Azure to deploy their services. As soon as Microsoft announcing the general availability of Windows Server 2012 R2, the image was available on all Azure Datacenters worldwide to start creating new devices with the latest OS, not only for the Virtual Machines flavor (IaaS), also for Cloud Services (PaaS). This converts Microsoft’s Cloud in the first one allowing to deploy VMs with it.

The new features included in this OS version are really awesome, and if you are publishing a website on Azure via VMs or Cloud Services you will be really-really happy, because two new enhancements included: IIS 8.5 and .NET Framework 4.5.1.

And that isn’t all, seems that Windows Server 2012 deploys a 30% faster than other previous Windows Server OS images on Azure, so deployment operations like redeploying a hosted service, creating staging environments, etc. will be done faster!! Did I mention new price cuts for memory intensive instances?

Application performance

On this framework release, some “most requested features” have been included, like the x64 edit and continue feature, the ADO.NET connection resiliency (I will write a separate blog post only for this one), etc. You can find an overview of this improvements on this MSDN blog post, but I would like to highlight two features because directly affects the performance of DNN running on Windows Azure, a subject that as you may know, I have been working on for the past years. Microsoft has delighted us by running and documenting the performance improvements using DNN Platform, so let’s summarize the results.

ASP.NET App Suspend

Until now, when an application hosted on IIS was idle for some time (20mins by default), the site was terminated in order to preserve server resources. The problem was that with applications like DNN that takes some seconds to warm-up to serve the first web request (let’s call this “cold startup”), a site with low traffic would appear really slow because would spend more time warming the application pool than serving the contents. The workarounds were to increase the Idle Time-out property of the pool, or when not having access to the IIS configuration, to use external periodic webrequests to avoid the application being shutting down. But this techniques were in detriment of server’s resources and many hosters were banning this type of webrequests to not end up with the server shared resources.

This new feature allows applications hosted on IIS 8.5 to be suspended instead of being terminated, so when the site is shutdown because of the idle timeout, instead of completely killing the worker process, all the state is saved into disk. A new webrequest to the application pool causes to bring the worker process again back into memory, and for the case of DNN, this means around a 90% of improvement. This really rocks!!

ASP.NET App Suspend

Check this video to see the experiment done by Microsoft guys that led to the numbers above.

IISPerformance

If you want to know more about this new feature, check this MSDN blog post from The .NET Team.

Multi-core JIT (MCJ) for ASP.net

The second great improvement in application performance with the .NET Framework 4.5.1 release is the Multi-core JIT support for applications using Assembly.LoadFrom and Appdomain.AssemblyResolve like DNN Platform, so if your are using a Medium sized or greater VM on Azure (VMs with more than one core), you will notice a good improvement on cold startups.

MultiCoreJIT

Enabling the awesome features

The Multi-core JIT feature is enabled by default if you use Windows Server 2012 R2 or just upgrade to .NET Framework 4.5.1, so you don’t need to do anything to turn it on. The ASP.net App Suspend feature can be enabled on IIS 8.5 in the application pool advanced settings:

IdleTimeoutAction

New service package for cloud services

While using Virtual Machines (IaaS), this can be easily achieved by deploying the new Windows Server 2012 R2 server image. But to get these benefits on a Cloud Service (PaaS) when using the DNN Azure Accelerator you will need to use the latest accelerator’s service package because as fix was needed.

OSFamily4

OSFamily4_b

What fix? I tested today that while changing the OS to Windows Server 2012 R2 instance, the service was cycling on the startup tasks. The cause of this was that the ocsetup.exe used to install the remote management service -that is needed to setup WebDeploy- is no longer included on the system32 folder on WinSrv2012 R2.

The new way of enabling features is by using “dism”, so after doing the following changes on the startup task (check http://forums.iis.net/t/1171432.aspx for more info), all worked fine:

   1:  if "%EMULATED%" == "true" goto SKIP
   2:  if not "%ENABLED%" == "true" goto SKIP
   3:   
   4:  dism /online /enable-feature /featurename:IIS-WebServerRole 
   5:  dism /online /enable-feature /featurename:IIS-WebServerManagementTools
   6:  dism /online /enable-feature /featurename:IIS-ManagementService
   7:  reg add HKEY_LOCAL_MACHINESOFTWAREMicrosoftWebManagementServer /v EnableRemoteManagement /t REG_DWORD /d 1 /f  
   8:  net start wmsvc >> SetupIISRemoteMgmt_log.txt 2>> SetupIISRemoteMgmt_err.txt
   9:  sc config wmsvc start=auto
  10:   
  11:  :SKIP
  12:   
  13:  EXIT /B 0

The new packages are available as an addon to the current DNN Azure Accelerator that you can download from CodePlex, called “DNN Azure Accelerator OS Family 4 packages”. Just download the .zip file and unzip it into the “/packages” folder in the accelerator. You will see those packages in the package selection step in the wizard.

OSFamily4_c

After deploying an instance with one of this new packages, you will notice that the DNN site is running on top of IIS 8.5.

DNN_PaaS_4.5.1

Hope this helps. If you have any question, just drop a comment on the post.

Thanks.

P.S. Have you seen the IIS 8.5 default page? Not yet? Here a screenshot Smile

localhost

¡Windows Azure MVP 2013!

Wow! Wow! Wow!!

MicrosoftMVPLogoVerticalHoy hay motivo de celebración. Cual ha sido mi satisfacción al ir a comprobar la bandeja de entrada y ver un correo con asunto “¡Enhorabuena MVP de Microsoft 2013!”, casi me da un patatús de alegría.

Para los que no sepan de qué va el tema –cosa harto difícil para aquellos que leen este blog- se trata de un nombramiento por parte de Microsoft en reconocimiento a la contribución realizada en las comunidades técnicas a lo largo del pasado año, en este caso en concreto en el área de Windows Azure.

Recognition

En este enlace de MSDN se encuentra más información acerca de este anuncio, así como en el propio portal de Microsoft MVP.

Quiero agradecer a todos los que han puesto de un modo u otro su granito de arena para que haya sido posible. A la familia que cada vez me ve menos el pelo pero siguen demostrándome todo su apoyo; a los amigos que siguen estando ahí en todo momento; a los compañeros de trabajo que considero como parte de la familia; a los compañeros de TenerifeDev con los que tantos buenos ratos he pasado; a todos los que me han dado su apoyo leyendo este blog, dándome sus opiniones y convertirme en mejor profesional; y por supuesto a Microsoft, tanto por el reconocimiento como por su apoyo a la comunidad, algo que llega a convertirse en un estilo de vida.

Y en especial a ti Carmen, que has sido y eres la que me ha soportado durante tanto tiempo delante de la pantalla sin bajar la palanca de la luz. Te quiero.

¡Un saludo y Happy Coding!

David Rodriguez

Windows Azure PowerShell: One script to rule them all

Are you in mobility and you have lots of SQL Azure DB Servers to manage? Does your public IP address change often and you’re sick of having to manually change the SQL Azure firewall rules?

Good news, I’m going to show you a PowerShell script to automatically add a firewall rule to ALL your SQL Azure servers in ALL your subscriptions for your current public Internet IP Address.

PowerShellDownloadBefore start, just be sure that you have installed the latest Windows Azure PowerShell package, that you can download from http://www.windowsazure.com/en-us/downloads/#cmd-line-tools

Setup your WA PowerShell subscriptions

The first part after downloading the Windows Azure PowerShell package is to setup the subscriptions you have access to. You will need to do this process only once, since the configuration settings will be stored in your profile, but perhaps you would like to revisit it later to add more subscriptions.

Configuring subscriptions by importing a .publishsettings file

The fastest way to setup the subscriptions is by importing a .publishsettings file containing an encoded management certificate data and subscription Ids:

1) Download your publish settings file:

PS C:> Get-AzurePublishSettingsFile

This will open a browser that, after introducing your LiveId, will automatically download your .publishsettings file. This file contains credentials to administer your subscriptions and services, so be sure to store it in a secure location or delete after use.

2) Import your .publishsettings file:

PS C:> Import-AzurePublishSettingsFile MyAzureCredentials.publishsettings

These settings will be stored inside “C:Users<UserName>AppDataRoamingWindows Azure PowerShell” folder.

Configuring subscriptions by using self-signed management certificate

Another way to setup your subscriptions would be to use your own self-signed management certificates, to avoid the automatic creation of management certificates in all your subscriptions and giving you more control on which subscriptions you are going to manage via PowerShell.

1) Create and Upload a Management Certificate for Windows Azure. Follow the instructions described in this MSDN article.

2) Run the following PowerShell script to access your subscription from PowerShell:

$subscriptionId = '<type your subscriptionId here>'

$subscriptionName = '<type a subscription name here>'

$thumbprint = '<paste your management certificate thumbprint here>'

 

$mgmtCert = Get-Item cert:\CurrentUserMy$thumbprint

Set-AzureSubscription -SubscriptionName $subscriptionName -SubscriptionId $subscriptionId -Certificate $mgmtCert

You can repeat this operation for each subscription you want to manage from PowerShell.

Finally, with both ways of configuring your Azure Subscriptions, you can verify which subscriptions you have setup by running “Get-AzureSubscription” Cmdlet.

AzureSubscriptions

One script to rule them all

Now that we have setup the subscriptions, the intention is to create a firewall rule in ALL the SQL Azure servers under ALL my subscriptions for my current public IP address, in order to manage them by using SQL Server Management Studio or whatever other tool.

Based on Alexander Zeitler’s blog post on the matter, I have added some modifications to build the following script that you can save in .ps1 file (I have called it RuleThemAll.ps1 Smile).

# Set a RuleName

$ruleName = "David Laptop"

 

# Get your public Internet IP Address

$externalIP = (New-Object net.webclient).downloadstring("http://checkip.dyndns.com") -replace "[^d.]"

 

# Loop all your subscriptions

Get-AzureSubscription | ForEach-Object { 

    Select-AzureSubscription $_.SubscriptionName

    

    # Loop all your SQL DB servers

    Get-AzureSqlDatabaseServer | ForEach-Object {

        $rule = Get-AzureSqlDatabaseServerFirewallRule -ServerName $_.ServerName -RuleName $ruleName

        if (!$rule) {

            New-AzureSqlDatabaseServerFirewallRule $_.ServerName -RuleName $ruleName -StartIpAddress $externalIP -EndIpAddress $externalIP 

        }

        else {

            Set-AzureSqlDatabaseServerFirewallRule $_.ServerName -RuleName $ruleName -StartIpAddress $externalIP -EndIpAddress $externalIP 

        }

    }

}

After a while, you will have the rule enabled in all your servers in all your subscriptions.

RuleThemAll

Hope this helps,

David Rodriguez

DNN Azure Accelerator 2013 Q3 Released

DNNPoweredByAzureHi, today I have released a new version of the DNN Azure Accelerator, the tool to deploy DNN Platform instances on Windows Azure by using cloud services (PaaS model).

You can download the latest version from CodePlex:

New features

The new features included in this release need deeper details:

  • Packages and solution upgraded to Azure SDK 2.1: all the packages has been rebuilt by using the latest Azure SDK version available, that comes with more features and support for the latest cloud services features. Check the Azure SDK 2.1 release notes for more information. Note that the previous Accelerator packages were built using the SDK 1.8;
  • Changed the use of a mapped network drive for a symbolic link: to avoid remapping issues executing “net.exe use” and “net.exe delete” commands, the new method for mapping the network location has been introduced by using a symbolic link to the network share. As a consequence, you will no longer see the X: mapped network drive. To access the drive contents:
    • From the webrole that mounted the drive, you can access the drive contents by browsing F: drive (or B: if it’s the first mount)
    • From any webrole, included the one that mounted the drive, you can access the drive contents by browsing “C:ResourcesDirectory<RoleDeploymentId>.DNNAzure.SitesRootroot”. Note that the alias “C:ResourcesDirectorysitesroot” is also available, and it’s the one being used by IIS
  • Support for Web Platform Installer custom feeds: now you can specify a custom feed Url for Web Platform Installer, so you can automate the installation of custom addons using this way. To build your own custom feeds, check this blog post.

Another important thing that changed on this release, is that Azure Connect is no longer supported in favor of Virtual Network, so the Connect step in the Wizard has been removed. The new step to setup Virtual Network through the wizard has not been included in this release, but you can get it working by including your virtual network settings directly on the .cscfg files before starting to create the cloud service. For more information about how this can be achieved, check the Windows Azure Virtual Network Configuration Schema documenation.

Release notes

New Features

  • Packages and solution upgraded to Azure SDK 2.1
  • Changed the use of a mapped network drive for a symbolic link to avoid remapping issues (you will not see the mapped X: drive anymore)
  • Support for Web Platform Installer custom feeds
  • Rebranding changes

Fixes

  • Fix for the CA2 certificate thumbprint that was being ignored
  • Fix for WebDeploy and FTP services while working on HA mode
  • Fixes around the drive unmount/mount logic when a failure is detected
  • Fix to include the databaseOwner and objectQualifier settings while creating the portal aliases for the Offline site
  • Fix to shorten the symbolic link path length (see http://geeks.ms/blogs/davidjrh/archive/2013/06/18/path-too-long-when-using-local-storage-in-an-azure-cloud-service.aspx for more info)
  • Implemented the RoleEnvironment.StatusCheck to programatically change the instance status from Busy to Ready after successfully setting up the IIS
  • Fix on the Compete for the lease process, causing a «Value cannot be null» exception after a deployment upgrade
  • Fix to modify the default connection limit to a higher value to avoid inrole caching connection timeouts
  • Fix to avoid 404 errors while calling the automatic installation process
  • Fix to add support for East US and West US in the accelerator Wizard

Deprecated

  • Azure Connect has been deprecated in favor of Virtual Networks. All Azure Connect support has been removed

 

Un saludo y happy coding!

[Event] CloudBurst 2013: the Sweden Windows Azure Group Developer Conference

CloudBurst2013CloudBurst is a Windows Azure developer conference run by the Sweden Windows Azure Group (SWAG). The event features two days of sessions from Windows Azure community and industry leaders and provides real-world content for Windows Azure developers and those wanting to explore the platform. The focus will be on developing Windows Azure applications and real-world cloud-based solutions.

The event will run for two days on September 19 – 20, 2013 at the headquarters of Microsoft in Stockholm, where the "top" Azure MVPs will share sessions around the Windows Azure platform. Organizers for SWAG are the two Swedish Windows Azure MVPs Alan Smith and Magnus Mårtensson.

The event is free to attend and if can’t go to Stockholm for the date don’t worry, the event will be streamed via Microsoft World Wide Events. You have all the information on the CloudBurst 2013 website:

CloudBurst 2013 event information

And don’t loose the “DNN Cloud Services – Under the Hood” session!

ReadySetGoIt is my pleasure to participate as a speaker in a session to discuss how we implemented DNN Cloud Services on the Windows Azure platform. For an hour I will be showing some details of the most interesting subsystems as the DNN Verification Extension Service created using Azure cloud services and messaging queues; how we have deployed about 20,000 instances of product trials with Windows Azure Pack for Windows Server on Virtual Machines and all fully automated; or how we have built a backend system using a CQRS pattern and able to deploy DNN instances on any infrastructure, from web Sites to Cloud Services.

See you in Stockholm!

Un saludo y “Happy Kodning”!!

PS: Did I tell you that you can still get an Aston Martin? Smile

[Evento] CloudBurst 2013: estos suecos se han vuelto locos!!

CloudBurst2013CloudBurst es una evento para desarrolladores de Windows Azure organizada por el grupo de usuarios de Windows Azure de Suecia (SWAG). El evento transcurre durante dos días llenos de sesiones de líderes de la comunidad e industria de Windows Azure, ofreciendo contenido de mundo real para desarrolladores de Windows Azure y también para aquellos que deseen explorar la plataforma.

El evento se desarrollará durante dos días, entre el 19 y 20 de septiembre de 2013 en la sede de Microsoft de Estocolmo, donde los “top” Azure MVPs compartirán sesiones alrededor de la plataforma. Los organizadores del grupo de usuarios SWAG son los dos Windows Azure MVPs Alan Smith y Magnus Mårtensson.

La asistencia al evento es totalmente gratuita y si te queda algo lejos no te preocupes, que también habrá streaming en directo a través de Microsoft World Wide Events. Tienes toda la información en el sitio web de CloudBurst 2013:

Información y registro de CloudBurst 2013

¡Y esta vez la lío con ellos!

ReadySetGoEs para mí un placer poder participar como ponente en una de las sesiones para hablar de cómo hemos implementado DNN Cloud Services sobre la plataforma Windows Azure –en este en post de MSDN Spain puedes encontrar información relativa al tema. Durante una hora mostraré los detalles de los subsistemas más interesantes como el DNN Extension Verification Service creado usando Azure cloud services y colas de mensajería; cómo hemos creado cerca de 20.000 instancias de pruebas de producto con Windows Azure Pack para Windows Server sobre Virtual Machines y todo de forma totalmente automatizada; o cómo hemos construido un sistema de backend mediante un patrón CQRS capaz de desplegar DNN sobre cualquier infraestructura, desde Web Sites hasta Cloud Services.

Nos vemos en septiembre.

Un saludo y “Happy Kodning”!!

P.D. ¿Te había dicho que todavía puedes conseguir un Aston Martin? Smile

“Path too long” when using local storage in an Azure Cloud Service

imageIt is insane that in 2013 we still try to workaround the 260 character limit in a file path, more when the conversations are centered on services, scaling and other meta-cloud philosophies.

But this problem is still here and working with VMs hosted in the cloud is no different, on-premise problems will appear in the same way when online. I would recommend the “Long Paths in .NET” series from Kim Hamilton where this matter is deeply discussed. The post is from more than 6 years ago…and this is not solved yet.

So let’s talk about the problem I had. When using local storage on an Azure web or worker role, the root location for this storage while running on Azure starts with a path that can “eat” almost the half of the MAX_PATH -note that I’m not referring to the problem when playing on DevFabric in your local environment, whose solution is commented on this MSDN blog post. This will be something like:

C:ResourcesDirectory<RoleDeploymentId>.<RoleName>.<LocalStorageName>

As example:

C:ResourcesDirectory5bfa990c7fe730f3a1c7c7b40d249462.MyWebRole.MyLocalStorage

The problem is that the RoleDeploymentId is 32 char length, and if you want to keep some sanity on your role names and storage names you will use something that has some meaning. In my case, the path was “eating” 108 chars, almost the half of the max path. While creating some recursive folders inside that temp path the “Path too long” error will appear sooner than later.

Techniques from the past to solve problems from the past

After playing a little bit with Subst.exe, didn’t convince me because I was trying to keep distance from mounting and managing drives between different user sessions. But then César Abreu give an interesting idea: why not use old style DOS format for the paths?

Interesting approach, so after some reading on the Fsutil.exe documentation on TechNet, I did some tests on a running instance:

1) Enable the short name behavior for volume C:

image

2) Add a short name to the local storage folder

image

3) Verify

image

I finally created a simple two line startup task to be executed with elevated privileges and that would give me an additional 83 characters.

REM Enable short names on volume C:
fsutil.exe 8dot3name set c: 0

REM Add a short name to the local storage folder
fsutil.exe file setshortname "C:ResourcesDirectory%RoleDeploymentID%.MyWebRole.MyLocalStorage" S
 

The first line enables the short name behavior for volume C:. I noticed that this is enabled for other volumes on an Azure role, but is not enabled by default on C: drive. The second line simply sets the folder short name as “S”. With this I can use then the path “C:ResourcesDirectoryS” instead of the long one, and worked like a charm. Note that you can’t do the same for “Resources” and “Directory” folder names, since they are in use during the role startup, and would give you an error while trying to do the operation.

Hope this helps!

Windows Azure: disponibilidad general de Infraestructura como Servicio (IaaS)

imageUno de los acrónimos que más está de moda en nuestros mundos de Azure es del de “GA”, que significa el cambio de un servicio en modo “Preview” a disponibilidad general (del inglés General Availability), pasando de ser un servicio con soporte limitado a un producto totalmente soportado, con sus SLAs, precios definitivos, etc. Pues hoy es uno de esos días en los que oyes por ahí: ¡Hey, que Windows Azure IaaS es ahora GA!

Y es que también es normal encontrarnos con alguna sorpresa cuando un producto pasa a ser GA, normalmente como “regalito” que acompaña el lanzamiento. Lo que era menos de esperar era que esos anuncios incluyeran co-lateralmente mejoras en precios en otros servicios como cloud services. ¿Más barato? Oh yeah!

Aquí podéis ver en detalle el anuncio de Scott Guthrie en su blog con todo lujo de detalles. No voy a copiar aquí todos ellos, sino que voy a hacer incidencia en lo que me parecen los 3 grandes noticiones de esta puesta en marcha de IaaS en Windows Azure.

Nuevas plantillas de VM

Una de las grandes novedades es que a partir de ahora ya puedes desplegar una máquina con SQL Server, BizTalk Server o Sharepoint sin tener que hacer frente al pago de la licencia completa del software de servidor, sino que continuando con el modelo de pago por uso, existe la modalidad del pago de un sobrecoste adicional al precio de hora estándar de computación. Hora que usas, hora que pagas. No lo usas, no lo pagas. Fácil.

En el caso de SQL Server, nos encontraremos con plantillas de SQL Server 2012 Standard y Enterprise desplegados sobre Windows Server 2008. Si bien ya hay precio para la edición Web, no hay plantilla para desplegarlo.

Para BizTalk también encontraremos plantillas para las ediciones de evaluación, la Standard y Enterprise. Para el caso de Sharepoint, aún no están disponibles los precios, aunque sí que está la plantilla de Sharepoint Server 2003 Trial.

image

Nuevos tamaños de máquina XXL y XXXL (A6 y A7)

Otra de las grandes novedades es la posibilidad de desplegar instancias de uso intensivo de memoria, viniendo a duplicar el tamaño ExtraLarge que teníamos hasta ahora en lo que a memoria RAM se refiere. De este modo, los tamaños de instancias irán desde A0 hasta A7, cada una duplicando en memoria a la anterior. OJO: no me preguntéis dónde se dejaron A5 (esto trataré de averiguarlo):

image

image

Nuevos precios reducidos, ¡y no sólo para IaaS, también para PaaS!

Por último, una de las terceras grandes novedades es el anuncio de una reducción de precios de un 21% sobre Windows Azure Virtual Machines (IaaS) y de un 33% de reducción de precios en soluciones desplegadas bajo modelo PaaS (toma ya! un 12% de rebaja adicional si despliegas DNN en modelo PaaS con el Accelerator!!!). Estos nuevos precios casan con la oferta actual bajo demanda de Amazon, tanto para máquinas Windows como Linux.

Cabe recalcar que si bien Windows Azure Virtual Machines (IaaS) está disponible generalmente desde hoy 16 de abril, se continuará ofreciendo el precio con descuento de la Preview hasta el 31 de Mayo. Los nuevos precios de GA tendrán efecto a partir del 1 de junio.

Precios para modelo IaaS

image

Precios para modelo PaaS

image

Toda la información de los nuevos tamaños de máquina y sus precios los puedes encontrar en este enlace: https://www.windowsazure.com/en-us/pricing/details/virtual-machines/

Conclusión

En este post he comentado las que me parecieron las tres principales novedades incluidas en este lanzamiento, pero hay muchas otras y otros pequeños huevos de pascua –¿comenté que ahora los VHD de S.O. son de 127Gb, o que puedes cambiar el nombre del usuario “Administrator”?-, así que no olvides visitar el post original de Scott Guthrie.

Por lo que he podido experimentar después de haber desplegado cerca de 100 servidores en modo IaaS desde su salida en modo Preview en Junio de 2012, el servicio de Windows Azure Virtual Machines ha ido mejorando en rendimiento, confiabilidad y disponibilidad. De hecho, el principal problema que podíamos encontrarnos a fecha de hoy era que al estar en modo Preview, no era un producto totalmente soportado con sus acuerdos de niveles de servicio. Con el lanzamiento de hoy, esto lo cambia todo, ya que todas los despliegues que tuvieras pasan a tener soporte y por lo tanto, pasa a ser un lugar donde puedes poner tus despliegues de producción.

Veremos qué más sorpresas nos traen nuestros amiguetes de Microsoft en los próximos meses. Están que lo petan con tanto anuncio.

¡Un saludo y happy coding!