Azure Resource Manager included with Azure SDK 2.5

Over the last couple of days I've put up some posts about Azure Resource Manager (ARM) including a high level post explaining what it is along with a look at some of the currently supported resource types. Overnight at the Connect(); event Microsoft released a preview of Visual Studio 2015. Along with that update the Azure team pushed out an updated Azure SDK (version 2.5) which includes the Azure Resource Management tooling. If you are working with ARM then you might want to check out the updated bits.

It isn't a huge change. The name of he project type has changed to Cloud Deployment Project as you can see in the picture below (it was previously called Cloud App from the Azure Gallery which was a bit of a mouthful).

The wizard itself now includes one additional project type which ads a Redis cache as a dependency:

Perhaps the biggest changes coming in what is put down on the file system after the project is created. You can see below that the Azure tool azcopy.exe has been added to the layout.

The azcopy.exe tool is used in a much more enhanced version of the Publish-AzureResourceGroup.ps1 script which not only provisions resources but uploads the web application package to an Azure storage blob so it can be imported via the MSDeploy extension that has been added to the Azure Website defined in the WebSiteDeploy.json template file. This should give you a flavour for the way Microsoft expects you to use Azure Resource Manager in conjunction with your traditional outputs from your build process.

#Requires -Version 3.0

What else would you like this script to do for you?  Send us feedback here:  

  [string][Parameter(Mandatory=$true)] $StorageAccountName,
  [string][Parameter(Mandatory=$true)] $ResourceGroupLocation,
  [string] $ResourceGroupName = 'WebApplication2',
  [string] $StorageContainerName = $ResourceGroupName.ToLowerInvariant(),
  [string] $TemplateFile = '..\Templates\WebSiteDeploy.json',
  [string] $TemplateParametersFile = '..\Templates\',
  [string] $LocalStorageDropPath = '..\bin\Debug\StorageDrop',
  [string] $AzCopyPath = '..\Tools\AzCopy.exe'

Set-StrictMode -Version 3

# Convert relative paths to absolute paths if needed
$AzCopyPath = [System.IO.Path]::Combine($PSScriptRoot, $AzCopyPath)
$TemplateFile = [System.IO.Path]::Combine($PSScriptRoot, $TemplateFile)
$TemplateParametersFile = [System.IO.Path]::Combine($PSScriptRoot, $TemplateParametersFile)
$LocalStorageDropPath = [System.IO.Path]::Combine($PSScriptRoot, $LocalStorageDropPath)

# Use AzCopy to copy files from the local storage drop path to the storage account container
Switch-AzureMode AzureServiceManagement  
$storageAccountKey = (Get-AzureStorageKey -StorageAccountName $StorageAccountName).Primary
$storageAccountContext = New-AzureStorageContext $StorageAccountName (Get-AzureStorageKey $StorageAccountName).Primary
$dropLocation = $storageAccountContext.BlobEndPoint + $StorageContainerName
& "$AzCopyPath" """$LocalStorageDropPath"" $dropLocation /DestKey:$storageAccountKey /S /Y"

# Create a SAS token for the storage container - this gives temporary read-only access to the container (defaults to 1 hour).
$dropLocationSasToken = New-AzureStorageContainerSASToken -Container $StorageContainerName -Context $storageAccountContext -Permission r 
$dropLocationSasToken = ConvertTo-SecureString $dropLocationSasToken -AsPlainText -Force

# Create or update the resource group using the specified template file and template parameters file
Switch-AzureMode AzureResourceManager  
New-AzureResourceGroup -Name $ResourceGroupName `  
                       -Location $ResourceGroupLocation `
                       -TemplateFile $TemplateFile `
                       -TemplateParameterFile $TemplateParametersFile `
                       -dropLocation $dropLocation `
                       -dropLocationSasToken $dropLocationSasToken `
                       -Force -Verbose

The ARM tools coming into the Azure SDK proper probably signals how important this particular feature is going to be for the Azure platform moving forward.