Posts in Category: Azure

WASABi Elastic Azure Scaling 

Categories: Azure Notes

Notes on Azure Elastic Scaling by Zoiner Tejada. This is again one of these PluralSight courses, where only the sample project is worth the membership to the site. Get it there. Check also: Channel 9 Autoscaling in Windows Azure 2013

Dodging the 503 server busy response

Scale for performance, capacity & availability
Costs of over-allocating (Ideally paying for exactly what is needed)

Scale out/in: adding/removing number of instances

Scale up/down: increasing/decreasing the power of resources

Database can be scaled out by sharding with federations

Elastic Scale: The ability to adjust resources according to demand.

Scaling vs Throttling

Things needed to allow automating scaling

  • Build tooling to monitor cloud service's key performance
  • Use the Windows Azure Service Management API from your code
  • Collect diagnostics
  • Maximize clock hour use in scaling decisions
  • Send admins notification
  • Manage cool down periods between scaling actions


WASABi diagram of components


  • Metronome: collects kpi data
  • Scaler + Stabilizer: manage scale and notifications
  • Tracker: log outcome of actions

Using WASABi

  1. Add reference to WASABI library from your project 
  2. Nuget: Autoscaling Application BLock
  3. Instantiate Autoscaler in code : var autoscaler = EnterpriseLibraryContainer.Current.GetInstance<Autoscaler>(); autoscaler.Start();
  4. Configure App, Service Information Store and Rules Store
  5. Deploy and run

Rule Evaluation
Contstraint rules over Reactive rules
Rule with highest integer rank wins
Intelligent scaling action on tie breaking

Scale and/or notifications
Stabilizer ScaleUpOnlyInFirstMinutesOfHour
Stabilizer ScaleDownOnlyInLastMintesOfHour

WASABi in Azure
Management Certificate
makecert -sky exchange -r -n "CN=<CertificateName>" -pe -a sha1 -len 2048 -ss My"<CertificateName>.cer"
via azure portal, settings, mgmt certs, upload
backup .pfx with password
export via mmc, certs snap-in, personal, export
put public and private key on machine running autoscaler

Add WASABi nuget
Add Enterprise Library config nuget

Update app.config (right-click)
point to Rules.xml
point to ServiceInfo.xml
add smtp info

Update ServiceInfo.xml
Make sure you save as utf-8 without signature!
Add xsd to schema
Update subscription
Update service
Update roles
Update stabilizer

Update Rules.xml
ConstraintRules eg. ScaleTargetHost min="2" max="6"
ReactiveRules eg. greaterOrEqual operand="averageCPU" than="30"
Operands eg. alias="averageCPU" performanceCOunterName="..."

Update diagnostics.wadcfg
eg. PerformaceCounters scheduledTransferPeriod="PT1M"

Pubish Web Role and Run Web Worker Autoscaler

Custom Operands
When performance counters, queue length or instance count aren't enough
For use by reactive rules only
eg. Queue msg depth, number of files in blob, business tickets, ...
Extend DataPointsParametersElement using IDataPointsCollector

Custom Actions
When adjusting instance count or changing settings isn't enough
eg. change role instance size, scale vm website db storage, send sms messages
Extend ReactiveRuleActionElement using instance of ReactiveRuleAction
Remember to put in your custom namespaces (xmlns="http://myfoo")

Azure Websites 

Categories: Azure Notes

Notes from Windows Azure Websites by Matt Milner

  • Application load balancer
  • Content + configuration in shared storage
  • http://<account>.azurewebsites.net


  • FTP, Web Deploy, Continues integration
  • Use EnableCodeMigrations to create the db and seed some default data
  • Use a publishing profile (import on web publish)
  • One ftp location even though you have multiple instances.

Pricing Models

  • Free only up to 10 sites, multi-tenant, limited dns entries, outbound data limits, throttles on cpu and memory usage.
  • Shared is multi-tenant, per site/instance charges, custom domain names, unlimited outbound charged separately.
  • Reserved is vm-size with 1-3 instances, up to 100 sites.

Counters: CPU, Data in/out, Http Errors, Requests
Diagnostics: Error pages, Logging, IIS logs, Failed request

Team Foundation Service
Setup publishing: Authorize and create build definition
Build: Publish to azure on succesful build

Local Git Repository
Setup publishing: Create repository on azure websites
Push: Push to git repository initiates build on azure
Build: Deploy to azure on succesful build


  • Make sure your dlls are correctly referenced (use nuget)
  • Correct your Web.Release.config (use preview transformation)
  • .gitignore (packages/ bin/ obj/ *.suo *.csproj.user)


  • Setup Git Publishing
  • git remote add fooazurealias https://<account>/foo.git
  • git push fooazurealias master

Hosted Git Repository
Codeplex, GitHub, BitBucket
Setup publishing: Create repo on azure, authenticate hosted with oauth
Push: Push to hosted, will post notification to azure, azure will clone repo
Link your Azure website to a specific branch on github.com

Windows Azure PowerShell


get-command -module azure

$mgmtCert = get-item cert:\\currentuser\my\$mgmtCertThumbprint

Set-AzureSubscription -SubscriptionName KensCloud -SubscriptionId $subscriptionID -Certificate $mgmtCert

Select-AzureSubscription -SubscriptionName KensCloud



New-AzureWebsite -Location "West US" -Name "fooNew"

$site = get-azurewebsite -Name fooNew


$site.HttpLoggingEnabled = $true

$site.RequestTracingEnabled = $true

$site.NumberOfWorkers = 3

$site | Set-AzureWebsite


npm install azure-cli

node azure account download

node azure account import c:\foo\foo.cer

del c:\foo\KensCloud-11-11-2011-credentials.publishsettings

node azure site create KensNode

node azure site browse KensNode

Azure Cloud & Storage Services 

Categories: Azure Notes

Some notes from Windows Azure Fundamentals by http://mattmilner.com

Fabric controller will keep the requested number of instances running.

Package & Configuration files

  • .cscfg is xml stating the os
  • .cspkg is just a zip file

Service Definition

  • Virtual machine sizing
  • Endpoints
  • Certificates
  • Websites (web role)
  • Environment variables
  • Startup tasks
  • Configuration settings declarations

Service configuration

  • Operation System
  • Instance count
  • Values for configuration settings
  • Certificate thumbprint

Managing Cloud Services

  • Affinity groups
  • Fault domains
  • Upgrade domains
  • VIP swap

Storage Services

  • x509 certificate and SSL
  • Storage Account Keys
  • ETags
  • Azure Storage Explorer


  • PartitionKey, RowKey, Entity (key/value pairs), Timestamp
  • Max 255 fields including keys
  • Matching partition keys = data in same physical partition
  • Transactions only on the same partition


  • Root container - Named container (first dir) - Blob (second dir and filename) 
  • http://<account>.blob.core.windows.net/images/web/background.jpg
  • Block blobs vs Page blobs
  • Content-cache metadata=TTL in CDN

Queues (max. 7 days)

  • No capitals in name allowed
  • 64kb Max after base64 encoded and including xml headers
  • eg. worker role that creates thumbnails or processes video
  • A worker role can update a message.

Azure Adventure 

Categories: Azure

Things to happen when trying to use Azure for the first time... (even though it seems negative, I am pro)

  • Needed to sign-up 4 times, I guess it was an issue with the i in my name vs I on my msdn.


  • First creation of website dissappeared.
  • Was not able to rename my second creation.
  • Deployed website from template (And now uploading extra files? Ftp? Git?)
  • You need to add deployment user.
  • Uploading with FTP is pretty slow. Probably because I was uploading to US. Ok first test works on azure only on wrong location.
  • gmail sending was blocked and suspiciously coming from USA while site should be in west europe?


  • My strong password was not accepted because some of the start letters where the same.
  • When trying to manage firewall issues. The current IP address is not included in existing firewall rules. Do you want to update the firewall rules in order to manage... (Log on to the Windows Azure Management Portal. In the navigation pane on the left, expand your subscription, and then select your SQL Database server by clicking it. In the center pane, view the server-level firewall settings for the selected SQL Database server by clicking Firewall Rules.)
  • Import DB needs storage account, and the azure documentation links to Azure MMC module that is not longer maintained (http://wapmmc.codeplex.com) but the other projects still seems to be there: http://azurestorageexplorer.codeplex.com/
  • A bacpac file is not a sql .bak file (http://sqldacexamples.codeplex.com/)
  • BACPAC files are Data-Tier Applications (aka DAC) packages which are essentially ZIPs that contain an XML representation of the schema and the actual table data stored in JSON format: Tasks -> Extract Data-tier Application -> Gives a dac not a bac  (http://blog.dotsmart.net/2012/10/09/backing-up-appharbor-databases-using-bacpacs/)
  • Use Management Studio 2012 (Uploading with wizard gives plenty of errors. All tables need clustered indexes. eg. ws_discount)

Virtual Machines

  • Signing up for virtual machines, networks and mobile services is separate.
  • Linux VM with meteor - Putty install: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html - sudo curl https://install.meteor.com | /bin/sh - meteor create --example leaderboard - cd leaderboard - meteor (will init mongo database on startup of application)
  • Virtual Machines –> Meteor –> Endpoints section in the Azure management portal, and add a TCP end point for port 3000 (myproject.cloudapp.net:3000)


And then internet hit me... no more internet connection... not even 3G I could thetter over to my laptop... nothing... not at my place not at the neighbours and friends... for hours and no support from customer service... the whole internet grid of flanders kaboem :) ... (edit: it turned out there were some major prodiver issues in flanders, belgium) 

Azure - The Big Picture - Notes 

Categories: Azure Notes

by David Chappell

Execution Models

Virtual Machines (IaaS)
VHDs from Gallery or User-Supplied (by the hour used or unused)
Azure Management Portal
Rest API for scripting and creating VMs in batch
One OS disk and one or more data disks (all stored as blobs)
You can move the image in and out the platform
eg. App + Sql cluster, Sharepoint farm, on demand vm for testing, disaster recovery
Only failed hardware will be fixed.
Requires the most management.

Web Sites
Shared IIS or Dedicated IIS
Static Websites
Popular Web Applications eg. Drupal, ...
Custom Web Applications eg. ASP.Net, Node.js, ...
Upload through ftp, WebDeploy, Repository (TFS, Git)

Cloud Services (PaaS)
Platform as a service
Web Roles - run iis
Worker Roles
The environment is created for you using code configuration
Detect failed applications and starts new one
So you can not store state in your VM file systems!
eg. app must be very reliable and very scalable
Low admin cost.
Needed when not possible with other options
eg. Admin access to VMs, to install arbitrary software
Background processing with workerroles
Connect to Azure Virtual Network
Combining technologies is possible.

Data Management

Sql Database Service
Disks are stored as blogs
Multi tenant virtual servers
Automatic data replication (setup 5 min)
Limited to some hunderd of gigabytes, else you need Sql Federation.
An application can work with two or more federation members that can have separate dbs and schema
Sql Data Sync between different datacenters in cloud or on-premise (with some latency)

Table Storage - NoSql
Key Value storage
Across multiple machines
Tables are partitioned with entities
Entities have properties of various types
Entities have row keys unique in their partition
Partitions have keys
eg. simple, fast access to loosly structured data
eg. very large about of data (up to 100 terabyte)
Much cheaper then sql but no query options

Blob Storage
Named containers
Large amounts of data such as video
For backup eg. whole VHDs

Business Analytics

Sql reporting
BI Studio & RDL-Files

Open source
Big data analysis
Map reduce over different systems
Large amount of unstructured data
Assumes data is in blobs
hdfs data api
Hive (with excel import), Pig, ...
eg. Log files, sensors like RFID, clickstream data, ...


Virtual Network
Connect your on-premise network with cloud network of VMs
Setup a segment of VMs as VNET
VPN Gateway Device with IPsec Connection needed
eg. Single sign-on with active directory, Dev/Test environments

Direct connection from application to group of on-premise servers
Windows Azure ConnectSoftware with IPsec Connection
No need to setup a full VPN

Traffic Manager
Routes users to datacenters that are most close to them
1. User lookup application dns name
2. DNS server redirects the query
3. AWTM applies policies
3a. Performance: to closest
3b. Failover: to specific unless down
3c. Round Robin: spread equaly across datacenters
4. Return chosen datacenter
5. Access application in datacenter


In cloud communication
Web role(front-end) instances to/from worker role(back-end) instances
1. Web role receives work
2. Web role sends message
3. Worker reads message
4. Worker does work
5. Worker delete message (or it will re-appear in the queue)

Service Bus
In cloud, on-premise, anywhere communication
Multi tenant, each user has its own namespace
Queues: one to one queued messaging (one way communication)
message with body and properties (key-value)
Topics: one to many publish and subscribe messaging using filters
Relays: two way bi-directional messaging (eg. servers behind firewalls)
each application opens outbound to relay, inbound communication is seen as incoming on outgoing tcp/ip
construction a stable ip


  • Caching: on the VM or distributed on an array of VMs (supports MemCached api)
  • CDN: Video stored in blob and distributed globally


  • Active Directory
  • Running Windows Server AD in Azure VMs eg. Sharepoint on a web farm
  • Using Azure Active Directory eg. Saas (software as a service) apps 
  • ACS for single sign on with FB, Google, ...

High-Performance Computing

  • HPC Scheduler


  • Media Services
  • Media Ingest - copy video into cloud blogs
  • Encoding - translate formats
  • Content Protection
  • Ad Insertion
  • Streaming
  • Partner Components
  • Using CDN to distribute if you feel like


  • Windows Azure Marketplace
  • Sell your azure application in the cloud
  • Selling datasets


  • .Net, Java, PHP, Python, Node.js, C++
  • Commandline tools for deployment from and to Linux and Macintosh