Download as pdf or txt
Download as pdf or txt
You are on page 1of 252

Programming Azure

Better,
Best Practices & DevOps
Subhasish Ghosh
Director, CloudCover.In Dec 8-12 2014
@nerdometer Microsoft,
Hyderabad
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Contact
e: subhasishghosh2013@hotmail.com, sghosh.oxon@yahoo.co.uk
m: +91-9916043731

LinkedIn: https://www.linkedin.com/in/sghosh2011
Skype: pink_floyd2008

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Objective of the Workshop:
Learn how to leverage Microsoft Azure features coupled with best
practices in VS2013 for architecting and developing highly-scalable
n-tier Web Applications

• 10:00am – 12:00pm – Session – 2 hrs


• 12:00pm – 12:30pm – Lunch Break
• 12:30pm – 2:30pm – Session – 2 hrs
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Day1 Day2 Day3 Day4 Day5
• Cloud
• Data Storage • Designing for
• Introduction Development • Caching on Azure
Options Withstanding Failure
Best Practices
• VM, Cloud Services
• WPI & WebMatrix3 • Using Managed
& Web Sites - • Why No-SQL? • Lab 6
- Demo Cache Service
Analysis

• MyFixIt Application • Web Sites & • Data Partitioning • DevOps: Source


• Lab 4
- Demo AutoScale – Demo Strategies Control

• One ASP.NET &


• Using Azure Redis
Microsoft Open • async in .NET 4.5 • Blob Storage • Lab 7
Technologies Cache

• VM Depot & Katana • Code Review & 3 • Code Review in • PowerShell Cmdlets
• Lab 5
walkthrough – Demos Best Practices VS2013 - Demos

• Using Queues on
• Lab 1 • Azure AD & SSO • Demos • Lab 8 & Lab 9
Azure
• Azure
Management • Lab 2 • Lab 3 • Code Examples • ASSESSMENT
portal walkthrough
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Laboratories 1,2,3,4,5,6,7,8,9
1. SETUP: Install Microsoft Azure SDK for .NET (vs2013) - 2.5, Install Visual Studio Express 2013 for Web with Microsoft Azure SDK –
2.5, Microsoft Azure PowerShell, Open Microsoft Azure Subscription TRIAL 30-day account. Create a VM, stop & stop-deallocate using
Azure PowerShell

2. SECURITY: Creating an ASP.NET MVC application and then adding Single Sign-On (SSO) to your application using Azure Active
Directory (AAD)

3. CLOUD SERVICES: Creating a Cloud Services (Web & Worker Roles) application. Publishing to Microsoft Azure associated with a
Microsoft Azure Storage Account; Configure Auto-scaling

4. AZURE MANAGED CACHE SERVICE: Creating a Cache for Azure Managed Cache Service using Azure PowerShell cmdlets.
Connecting to this MCS from a client application.

5. AZURE REDIS CACHE: Creating and configuring Azure Redis Cache, configuring cache clients, adding and removing objects from
the cache, and storing ASP.NET session state in the cache.

6. MONITORING CODE: Creating a New Relic account, integrating it with an Azure Web Sites application and then publishing to Azure;
and checking out the tool

7. SOURCE CONTROL: Using Git in VS2013, Exploring features (branches, merging, comments etc.)

8. DEVOPS AUTOMATION: Using Microsoft Azure PowerShell – installation, cmdlets, Azure Subscription details and Runbooks
Introduction

9. STAGED PUBLISHING: Staged Publishing feature of Azure Web Sites along with GitHub Integration

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
2 Take Home Challenges!
End of Day 1 & Day 3

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Assessment
End of Day 5
20 Multiple Choice Questions, 40 Minutes
- Each Correct answer = 5 points
- Each Incorrect answer = 0
- Maximum Score = 20 * 5 = 100/100

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
DAY #1

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Demo #1
Web Platform Installer (Web PI) &
WebMatrix3

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Demo #2
VS2013 – Latest
Features

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Demo #3
MyFixIt Application

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Current Trends

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
We are gonna talk about…

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Microsoft Open Technologies

http://msopentech.com/

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
https://vmdepot.msopentech.com/

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Demo #4
Tinkering around with VM Depot

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
http://katanaproject.codeplex.co
m/

Microsoft via Katana is building a set of components around hosting


abstraction for your applications. That hosting abstraction is 'OWIN'.

OWIN is a specification. Not a code // library // framework.

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Katana Architecture

http://msopentech.com
/

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Demo #5
Tinkering around with Katana Project

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Quick Demo

Blank Application

PM> Install-Package
Microsoft.Owin.Host.SystemWeb
PM> Install-Package
Microsoft.Owin.Diagnostics
+91-9916043731 PM> Install-Package
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
http://msopentech.com
/

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Inside the OWIN Startup class, enter:
app.UseWelcomePage();

Press F5
Runs OWIN app using
System.Web
(IIS/ASP.NET)

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Project Katana
DEMO:
. How to run same program using OWIN default
server, HttpListener?
http://msopentech.com
/

HINT: Tinker with


Microsoft.Owin.Host.HttpListener

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Lab #1
WPI 5.0, Install Microsoft Azure SDK for .NET (vs2013) - 2.5
Install Visual Studio Express 2013 for Web with Microsoft Azure SDK –
2.5
Microsoft Azure PowerShell, Open Microsoft Azure Subscription TRIAL 30-
day account
Create a VM, stop & stop-deallocate using PowerShell
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Azure Portal
Walkthrough

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Take Home Challenge!
Enabling Trace Warning on Cloud using VS2013

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
DAY #2

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Day1 Day2 Day3 Day4 Day5
• Cloud
• Data Storage • Designing for
• Introduction Development • Caching on Azure
Options Withstanding Failure
Best Practices
• VM, Cloud Services
• WPI & WebMatrix3 • Using Managed
& Web Sites - • Why No-SQL? • Lab 6
- Demo Cache Service
Analysis

• MyFixIt Application • Web Sites & • Data Partitioning • DevOps: Source


• Lab 4
- Demo AutoScale – Demo Strategies Control

• One ASP.NET &


• Using Azure Redis
Microsoft Open • async in .NET 4.5 • Blob Storage • Lab 7
Technologies Cache

• VM Depot & Katana • Code Review & 3 • Code Review in • PowerShell Cmdlets
• Lab 5
walkthrough – Demos Best Practices VS2013 & Docker - Demos

• Using Queues on
• Lab 1 • Azure AD & SSO • Demos • Lab 8 & Lab 9
Azure
• Azure
Management • Lab 2 • Lab 3 • Code Examples • ASSESSMENT
portal walkthrough
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Take Home Challenge! Solution
Enabling Trace Warning on Cloud using VS2013

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Cloud Development Best
Practices

Stateless WebScale-Out Web Tier


Tier Behind an Based on No Session State; Use CDN for
Actual Demand
astic Load Balancer Use Cache Static Objects/Files

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Microsoft Azure
Compute

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Azure Cloud Services

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Workloads for Cloud Services
• VM is explicitly IaaS, Cloud Services is explicitly PaaS, Web Sites is explicitly
hosting.

• Cloud Services gives you administrative access to your application's VMs.


Web Sites do not provide this. This lets you install arbitrary software that
your application needs, something that's not possible with Web Sites.

• N-tier stateless applications is perfect for Cloud Services. Offers both web
roles and worker roles (requirement for separate VMs for their business
logic).

• Cloud Services provides separate staging and production environments,


making application updates somewhat smoother than Web Sites.

• Cloud Services lets you use networking technologies such as Azure Virtual
Network and Azure Connect to hook on-premises computers to Cloud
Services applications. No such thing on Web Sites.

• Cloud Services lets you use Remote Desktop to connect directly to an


application's VMs. No such thing on Web Sites.

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Microsoft Azure Service Model
Example cloud service configuration with a single web role and a
single worker role

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Mixing Virtual Machines &
Stateless Roles
Multiple cloud services with stateless and virtual machines

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Demo #6
Creating Cloud Service, creating a VM and attaching VM inside a Cloud
Service.

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
VIPs in Cloud Services
- Public IP address
pointing to Azure
Cloud Service where
VM is deployed.
- Every Cloud Service
has a VIP and every
Cloud Service can
have several VMs.
- A VIP assigned to
Cloud Service won’t
be released until last
VM on that Cloud
Service is Stopped
(De-allocated) or
Deleted

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Connecting Cloud Services via
VIPs

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Connecting Cloud Services via
VNET

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Azure Web Sites

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
PaaS

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Demo #7
Azure Web Sites

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Under the Hood

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Under the Hood

- Load Balancing at Layer 7


- Smart
- Routes Traffic to Distinct Fault Domains

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Demo #8
Auto-Scaling Options in Azure

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
async Support in .NET 4.5

Anyone using async


in
.NET 4.5 today?
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
async Support in .NET 4.5

- async language support to build non-blocking,


asynchronous, server-side applications

- ASP.NET MVC, Web API and WebForms have built-in


async language keyword support as of .NET 4.5

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
What happens in async? 1. An event handler calls and awaits
the AccessTheWebAsync async
method.

2. AccessTheWebAsync calls the


GetStringAsync asynchronous
method to download the contents of
a website as a string.

3. Something happens; to avoid


blocking resources, GetStringAsync
yields control to its caller,
AccessTheWebAsync.

4. DoIndependentWork is a
synchronous method that does its
work and returns to its caller.

5. AccessTheWebAsync uses an
await operator to suspend its
Programming Azure Better, Best Practices & DevOps
progress and to yield control to the
subhasishghosh2013@hotmail.com
+91-9916043731 method that called
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Properties
- async code is NOT multi-threaded code

- by default, code written within async & await are


single-threaded.

- async & await lets us run methods


asynchronously & not code multi-threaded manner

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
3 Best Practices for async
- async void only for top-level event
handlers

- The threadpool is for CPU-bound code,


not IO-bound code

- Your methods cannot lie

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Best Practice #1
Use Case 1

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Code in the application…

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Control Flow…

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Which await returns
earlier?

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Convert the async
void to Task
returning method
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Best Practice #2
Use Case 2

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Code in the application…

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Control Flow…

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Replace for with Parallel.For

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Things should
become Faster?
Right?
Poll: Yes | No
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
What happens…

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
On my laptop, it is 2
cores.
So 2 threads are
allocated for the
+91-9916043731
job.
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
Response time 300
Ms is better than 500
Ms.
Right?
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
WRONG!

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
What actually
happens…

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Is it CPU-bound OR
IO-bound that is
faster?
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Parallel.For keeps on allocating new threads. Start1 and Start2 are waiting,
so Start3 and Start4 are spawned. But the issue is…
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Threadpool is
Application-Global
resource.

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
This is how it should be…

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Do not use CPU-
bound. Use async for
IO-bound.
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Best Practice #3
Use Case 3

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Your methods cannot lie
- A synchronous method should execute
synchronously
- An asynchronous method should execute
asynchronously
- Do not expose asynchronous
wrappers around synchronous
methods
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
2 methods

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
3 types of methods

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Cloud Identity | Synchronized |
ADFS

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
PaaS
Azure Active Directory (AAD)

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Classic Use Case
There are two apps on the web and the user has a plain-old browser.

Since the two apps never talk to each other directly, a mechanism would
need to be devices where the user logs onto App A, receives and access
token into their browser and passes it through to App B with then calls
back to App A via some API to make sure the access token is valid.

If we passed the access token into the user’s browser so it’s possible it
could be snatched (perhaps by some malicious javascript). This is why
most developers stick to the standard SSO protocols like SAML, OpenID
and WS-Federation for the classic web-app to web-app single sign-on.

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Demo #9
Active Directory Options in Azure

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Lab #2
Creating an ASP.NET MVC application that utilizes SSO with Azure AD

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
4 steps:
. Creating an AD user using Microsoft Azure
Management portal

. Creating an ASP.NET MVC application using VS2013

. Ensuring AD user has ‘Global Rights’ and correctly set


permissions for logging-in using Azure AD

. Connecting the application to Azure AD

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Ensure “new user” has Global_Admin rights

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Open VS2013 as “admin”  New Project  Visual C#  ASP.NET Web Application, call it “ExpenseReports”.

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Now go back to Azure
Management portal, open the
AD we created earlier and then
go to “Applications” tab. You will
find “ExpenseReports” added
there.

Inside “ExpenseReports”  go to “Users” and then select Iam (i.e. test@ContosoEngineeringHyd.onmicrosoft.com) and ASSIGNED
= YES.

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Now go back to VS2013 and “build” the application. Then press F5. This will open up the application and redirect to the sign-in
page.

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
DAY #3

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Day1 Day2 Day3 Day4 Day5
• Cloud
• Data Storage • Designing for
• Introduction Development • Caching on Azure
Options Withstanding Failure
Best Practices
• VM, Cloud Services
• WPI & WebMatrix3 • Using Managed
& Web Sites - • Why No-SQL? • Lab 6
- Demo Cache Service
Analysis

• MyFixIt Application • Web Sites & • Data Partitioning • DevOps: Source


• Lab 4
- Demo AutoScale – Demo Strategies Control

• One ASP.NET &


• Using Azure Redis
Microsoft Open • async in .NET 4.5 • Blob Storage • Lab 7
Technologies Cache

• VM Depot & Katana • Code Review & 3 • Code Review in • PowerShell Cmdlets
• Lab 5
walkthrough – Demos Best Practices VS2013 & Docker - Demos

• Using Queues on
• Lab 1 • Azure AD & SSO • Demos • Lab 8 & Lab 9
Azure
• Azure
Management • Lab 2 • Lab 3 • Code Examples • ASSESSMENT
portal walkthrough
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Recap
Day 1 & Day 2

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Data Storage Options
Case Study:
Organization based in Mumbai. Has developed HRMS
application using .NET on Azure. Scaled faster than
expected. Have issues with storing data, processing
data, reporting and also scaling app.

MISSING –

SQL vs. Balancing


SQL DB (PAAS)SQL VM (IAAS)
NoSQL Priorities

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Data Storage Options

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Best Practices
Data Storage Options
1
No "one-size fits all"

2As applications scale,


consider
NoSQL along with SQL
3Single App with
Multiple Data
Storage Options

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Questions to Ask

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Azure SQL Db Vs. SQL Server
in VM

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Why No-SQL?
- Huge Data Sets
- Denormalized Data Sets
- Need fast access to
unstructured data

- Example use cases:


- Social Media, Analytics,
Security, and Compliance
- Analyse and search data of all
types, such as text, images,
videos, music.
- High-performance core data
processing and analytics.
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Brief Intro – Mongo DB
- Mongo DB stores data in the form of documents, which are
JSON-like field and value pairs.
- Documents are analogous to structures in programming
languages that associate keys with values (e.g. dictionaries,
hashes, maps, and associative arrays).
- Formally, Mongo DB documents are BSON documents. BSON is a
binary representation of JSON with additional type information.
In the documents, the value of a field can be any of the BSON
data types, including other documents, arrays, and arrays of
documents.

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Brief Intro – Mongo DB
- Mongo DB stores all documents in collections. A collection is a
group of related documents that have a set of shared common
indexes. Collections are analogous to a table in relational
databases.

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Example
- Storing blog posts and related info. SQL Schema:

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Example
- Storing blog posts and related info. Mongo DB Schema:

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Data Partitioning Strategies

Horizontal
Vertical
Partitioning
Partitioning
(SHARDING)

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Vertical Partitioning

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Sharding

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
BRAIN TEASER!!!!!!!!!
Hybrid Partitioning

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Plan BEFORE Architecting &
Coding
“Growing Fast“

- Semantics

Compute
- Scale Average Usage

- Queries Time

“Predictable Bursting“
- Analytics
- Real-time

Compute
Average Usage

Time

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Using Blob Storage (Binary
Large OBject)

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Demo #10
- Creating Image for DB, creating VM from Image
- VS2013 Code Review of SQL DB & EF

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Demo #10: Understanding the
Code

Open VS2013  MyFixIt.Persistence 


MyFixItContext.cs
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Demo #10: Understanding the
Code
The FixItContext class derives
from Entity Framework,
DbContext class, identifies the
database and specifies the
tables in the database.

The connection string in the


Web.config file is called
“appdb”. Here, points to the
local development database.

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Demo #10: Understanding the
Code

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Demo #10: Understanding the
Code
The Entity Framework creates a
FixItTasks table based on the
properties included in the
FixItTask entity class.

This is POCO (Plain Old CLR


Object) class. EF creates a
table and executes a CRUD
(create-read-update-delete)
ops.

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Server Explorer  appdb  FixItTasks  Right-click and Show Table Data

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Demo #11
- Creating Storage Account from Azure Portal
- VS2013 Code Review of Blob creation

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Lab #3
Creating HelloWorldHYD2014 Cloud Services (Web & Worker Roles)
application and Publishing to Microsoft Azure; Storage Account;
Configure Auto-scaling.

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
• Let’s go step by step to build this application.
• Open Azure Storage Emulator. Open VS2013 ‘as administrator’.
• New Project  Templates  Visual C#  Cloud  Azure Cloud Service  name it “HelloWorldHyderabad”

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
• Select Visual C#  one “ASP.NET Web Role” and “Worker Role”. Call it “HelloWorldWeb” and
“HelloWorldWorker”.

• Select MVC, OK
• This creates the project

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
• Right-click and Build the solution. The press F5.

• Let us now add a


HelloWorld
controller.
HelloWorldWeb 
Controller  Right-click
and “Add”  Controller.
It opens a new dialog
box. Select the “Empty
Controller”.

Name it
“HelloWorldHyderabad
Controller”.
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Open App_Start  RouteConfig.cs
Controller = should be same as
controller name in .cs

Build All  Press F5 to


run. You should see
“Hello World!” on your
browser.

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
• Right-click the cloud service, and then select “Publish”.
• Sign-in into your Azure Subscription account; which you need to
select; and then settings where you can either select an existing
storage account in same region OR create a new one in same region.
• Proceed next stage for provisioning this Cloud Service on Azure.
• While provisioning, you can switch to Azure Management Portal and
see the VMs (Web & Worker Roles) getting created, Storage Account
getting created as well.

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Take Home Challenge!
Create an Azure Web Site and I want to set up Auto-scaling such that
when the load increases greater than 32% on target CPU till 73%; I
will have at least 2 CPUs at the lowest point and 5 at the highest
point.

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
DAY #4

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Day1 Day2 Day3 Day4 Day5
• Cloud
• Data Storage • Designing for
• Introduction Development • Caching on Azure
Options Withstanding Failure
Best Practices
• VM, Cloud Services
• WPI & WebMatrix3 • Using Managed
& Web Sites - • Why No-SQL? • Lab 6
- Demo Cache Service
Analysis

• MyFixIt Application • Web Sites & • Data Partitioning • DevOps: Source


• Lab 4
- Demo AutoScale – Demo Strategies Control

• One ASP.NET &


• Using Azure Redis
Microsoft Open • async in .NET 4.5 • Blob Storage • Lab 7
Technologies Cache

• VM Depot & Katana • Code Review & 3 • Code Review in • PowerShell Cmdlets
• Lab 5
walkthrough – Demos Best Practices VS2013 & Docker - Demos

• Using Queues on
• Lab 1 • Azure AD & SSO • Demos • Lab 8 & Lab 9
Azure
• Azure
Management • Lab 2 • Lab 3 • Code Examples • ASSESSMENT
portal walkthrough
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Take Home Challenge! Solution
Create an Azure Web Site and I want to set up Auto-scaling such that
when the load increases greater than 32% on target CPU till 73%; I
will have at least 2 CPUs at the lowest point and 5 at the highest
point.

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Caching on Azure
- Excellent for Read-Only Pattern when
underlying services of a Distributed
System is having issues

- Do not hit data source every time

- Cached data works well if customer


experience is taking a hit

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
3 Types of Cache
- Azure Managed Cache Service

- Azure Redis Cache

- Azure In-Memory Cache

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Azure Managed Cache Service
(MCS)
- Must use for building fast, highly scalable n-tier web
applications

- Secure, Dedicated Cache, SLA 99.9% availability

- 3 offerings:
• Basic - 128MB to 1GB cache sizes, non-HA, 128GB
increments
• Standard - 1GB to 10GB cache sizes, non-HA, 1GB
increments
• Premium - 5GB to 150GB cache
Programming Azure Better, Best Practices & DevOps sizes, HA, 5GB
subhasishghosh2013@hotmail.com
+91-9916043731
Lab #4
Creating a Cache for Azure Managed Cache Service using Azure
PowerShell cmdlets. Connecting to this MCS from a client application.

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
New-
AzureManagedCache
-Name HydDemoCache
-Location "South
Open Azure PowerShell Type in “Add-AzureAccount”
Central US" -Sku Basic
as administrator which enters a dialog. Add
your Hotmail id associated
-Memory 128MB
with Azure subscription
account and proceed.

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Go to “Configure” and “Scale” options to review the options available.

Open VS2013 as admin; add a project; right-click and


then click “Manage NuGet packages”. Search for
“WindowsAzure.Caching” and then from the search
items, select “Windows Azure Caching”.

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Open web.config file.
Identify this line: “<autoDiscover isEnabled="true" identifier="[Cache role name or
Service Endpoint]" />”

Replace [Cache role name or Service Endpoint] with the endpoint URL which is displayed on the Cache
Dashboard in the Management Portal. In our example:

<autoDiscover isEnabled="true" identifier="hyddemocache.cache.windows.net" />

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Uncomment the securityProperties section, and replace [Authentication
Key] with the authentication key from the Azure portal  Manage Keys 
Primary Key

To use this programmatically:

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Redis
- In-memory Cache – key/value store but
took one step further.

- Excellent replacement for memCached

- But not a replacement for persistent


storage ( e.g. SQL server )

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Redis Tutorial
- http://try.redis.io/

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Azure Redis Cache
- Secure, dedicated Redis cache, managed
by Microsoft. A cache created using Azure
Redis Cache is accessible from any
application within Microsoft Azure.

- Microsoft Azure Redis Cache will be


available in two tiers:
- Basic – Single node. Multiple sizes up to
53GB
- Standard – Two-node Master/Slave.
Includes 99.9% SLA and replication
support. Up to 53 GB
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Lab #5
Creating and configuring a cache, configuring cache clients, adding and
removing objects from the cache, and storing ASP.NET session state in
the cache.

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
3 steps
- Create the cache

- Configure the cache

- Configure the cache clients

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Azure Management portal 
Cache

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Now, we will configure the cache clients.

- Open VS2013, create an ASP.NET application, and then install using


NuGet Powershell –
#install-package StackExchange.Redis
#install-package
StackExchange.Redis.StrongName
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Using Redis Cache in Code
Reference to the cache

- In order to programmatically work with a cache, you


need a reference to the cache. Add the following to the
top of any file from which you want to use the
StackExchange.Redis client to access an Azure Redis
Cache:

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Using Redis Cache in Code
Connect to the cache

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Using Redis Cache in Code
Set expiration to items in cache

- To specify the expiration of an item in the cache, use the


TimeSpan parameter of StringSet.

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Using Redis Cache in Code
Store ASP.NET Session State in cache

- Azure Redis Cache provides a session state provider that


you can use to store your session state in a cache rather
than in-memory or in a SQL Server database. To use the
caching session state provider, first configure your
cache, and then configure your ASP.NET application for
cache using the Redis Cache Session State NuGet
package.

#install-package
Microsoft.Web.RedisSessionStateProvider
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Using Redis Cache in Code
Check Web.config file

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Queuing on Azure
- Enable more loose-coupling between web tier
& back-end
- Enable asynchronous message processing in
case of failures

- 4 Key use cases to Identify:


- High CPU
- High Latency
- Frequent / In-frequent Load Bursts
- Service requiring a 3rd-Party Input
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Use Cases (Application
Developer)
- Your application must store over 80 GB of messages
in a queue, where the messages have a lifetime
shorter than 7 days.

- Your application wants to track progress for


processing a message inside of the queue. This is
useful if the worker processing a message crashes.
A subsequent worker can then use that information
to continue from where the prior worker left off.

- You require server side logs of all of the


transactions executed against your queues.
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Tightly Coupled

MyFixIt Application
MyFixIt DB
Web Server

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Loosely Coupled

MyFixIt DB

MyFixIt Application
Web Server Queue Listener

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Loosely Coupled, 1 Web Tier

Task Queue

MyFixIt Application Queue Listener


Web Server

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Loosely Coupled, n Web Tier

Task Queue

Queue Listener
Queue successfully handles
burst

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Demo #12
How to leverage Queues in VS2013

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
How to use it?

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
How to use it?

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Old code

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
New code

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
DAY #5

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Day1 Day2 Day3 Day4 Day5
• Cloud
• Data Storage • Designing for
• Introduction Development • Caching on Azure
Options Withstanding Failure
Best Practices
• VM, Cloud Services
• WPI & WebMatrix3 • Using Managed
& Web Sites - • Why No-SQL? • Lab 6
- Demo Cache Service
Analysis

• MyFixIt Application • Web Sites & • Data Partitioning • DevOps: Source


• Lab 4
- Demo AutoScale – Demo Strategies Control

• One ASP.NET &


• Using Azure Redis
Microsoft Open • async in .NET 4.5 • Blob Storage • Lab 7
Technologies Cache

• VM Depot & Katana • Code Review & 3 • Code Review in • PowerShell Cmdlets
• Lab 5
walkthrough – Demos Best Practices VS2013 & Docker - Demos

• Using Queues on
• Lab 1 • Azure AD & SSO • Demos • Lab 8 & Lab 9
Azure
• Azure
Management • Lab 2 • Lab 3 • Code Examples • ASSESSMENT
portal walkthrough
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Design to Survive Failures

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Failures will happen.

You either gracefully


handle it, or die.

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Types

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Understanding Scope…
3
2
1
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Application SLA = ?

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Buy a Good Telemetry Service

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Lab #6
Creating a New Relic account, integrating it with an Azure Web Sites
application and then publishing to Azure; and checking out the tool 

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Open web site, go to CONFIGURE, app settings

Open web site in WebMatrix, and then edit using VS2013.


Go to NuGet Package Manager Console:

Go into the newrelic.config file, and


copy in the license key from
Connection Info
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Build in VS2013, save all files and exit. Close V2013, open WebMatrix and
then “Publish”. It shows the new files to publish, click OK and proceed.

Go back to Azure portal, and


then NewRelic and then click
on ‘Manage your application
and service’. Takes you to the
NewRelic website and then
after accepting TOS….

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
DevOps

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
DevOps

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
DevOps on Cloud

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
DevOps Principles

Use Source Control Automate Repetitive


Tasks using Runbooks

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Source Control

Treat Automation No check-in Branch out sources


Use It for DevOps processes
Scripts as of secrets (passwords,
Source Control settings) & workflows

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Create sub-branches
Production

Code in final
testing

Features being
Integrated

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Need a Hotfix/Bugfix?
Production

Code in final
testing

• Confidence
• Agility
• Less Prone to
Errors
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Using Distributed Source
Control
• Git
• Mercurial
• TFS

• Visual Studio 2013 supports Git


• Git-tooling built in
• TFS Server & TFS Online Service
now supports publishing Git
repository
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Store Sensitive Data in Azure

• Connection Strings in Azure

• Web.config stores 2
connection strings for
Microsoft Azure
password and the key to an
Azure storage account

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
• Using Git in VS2013
• Add Solution to Source Control
• Git, OK, creates Git repository in solution folder
• Right-click Solution Explorer, Commit
• Enter commit comment, and click Commit
• Compare with Modified, to see changes that were
made

Lab #7
• Explore Branches, Merging etc.

Using Git in VS2013

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Automation in Microsoft Azure

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Automation in Microsoft Azure

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Demo #13
How to leverage Automation in Azure Management
Portal

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
What are Cmdlets?
A cmdlet is a lightweight command that is used in the Windows
PowerShell environment. The Windows PowerShell runtime invokes
these cmdlets within the context of automation scripts that are
provided at the command line. The Windows PowerShell runtime also
invokes them programmatically through Windows PowerShell APIs.

Cmdlets perform an action and typically return a Microsoft .NET


Framework object to the next command in the pipeline. To write a
cmdlet, you must implement a cmdlet class that derives from one of
two specialized cmdlet base classes.

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Lab #8
Playing around with PowerShell Cmdlets & Run Books

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
A few common Cmdlets:
• Set-ExecutionPolicy
• Add-AzureAccount
• Get-AzureSubscription
• Set-AzureSubscription
• Get-AzurePublishSettingsFile
• Import-AzurePublishSettings File
• Get-AzureLocation
• New-AzureAffinityGroup
• New-AzureStorageAccount

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Open PowerShell as “admin”

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Before assigning CurrentStorageAccountName After assigning CurrentStorageAccountName to
to AzureSubscription AzureSubscription

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Before assigning CurrentStorageAccountName After assigning CurrentStorageAccountName to
to AzureSubscription AzureSubscription

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Staged Deployment & GitHub
Integration
When you deploy your application to Azure Web Sites, you can deploy to a separate
deployment slot instead of the default production slot, which are actually live sites with
their own hostnames. This option is available in the Standard web hosting plan.
Furthermore, you can swap the sites and site configurations between two deployment
slots, including the production slot.

Deploying your application to a deployment slot has the following benefits:

1. After a swap, the slot with previously staged site now has the previous production
site. If the changes swapped into the production slot are not as you expected, you
can perform the same swap immediately to get your "last known good site" back.
2. Deploying a site to a slot first and swapping it into production ensures that all
instances of the slot are warmed up before being swapped into production. This
eliminates downtime when you deploy your site.
3. The traffic redirection is seamless, and no requests are dropped as a result of swap
operations.
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Lab #9
Staged Deployment in Azure Web Sites with GitHub
Integration

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Go inside ‘Staging Web
Site’ and Quick Glance.

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
- Inside VS2013, right-click “project” and “Add to Source Control”
- Team Explorer  Changes  Commit the changes with a comment

- We then need to choose which Repository you wish to connect. Give URL for your GitHub
repository from the Azure Management Portal. And then connect in dialog and commit.

- Go to GitHub account repository, you will see the project has been pushed to GitHub.

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
- Go to Make a change in the Startup script (add a comment for example), and “Included
Changes” will appear.

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Now make one more change in Startup file in VS2013; commit the changes, and then sync.

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Day1 Day2 Day3 Day4 Day5
• Cloud
• Data Storage • Designing for
• Introduction Development • Caching on Azure
Options Withstanding Failure
Best Practices
• VM, Cloud Services
• WPI & WebMatrix3 • Using Managed
& Web Sites - • Why No-SQL? • Lab 6
- Demo Cache Service
Analysis

• MyFixIt Application • Web Sites & • Data Partitioning • DevOps: Source


• Lab 4
- Demo AutoScale – Demo Strategies Control

• One ASP.NET &


• Using Azure Redis
Microsoft Open • async in .NET 4.5 • Blob Storage • Lab 7
Technologies Cache

• VM Depot & Katana • Code Review & 3 • Code Review in • PowerShell Cmdlets
• Lab 5
walkthrough – Demos Best Practices VS2013 & Docker - Demos

• Using Queues on
• Lab 1 • Azure AD & SSO • Demos • Lab 8 & Lab 9
Azure
• Azure
Management • Lab 2 • Lab 3 • Code Examples • ASSESSMENT
portal walkthrough
Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com
+91-9916043731
Assessment
End of Day 5
20 Multiple Choice Questions, 40 Minutes
- Each Correct answer = 5 points
- Each Incorrect answer = 0
- Maximum Score = 20 * 5 = 100/100

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
24 BEST PRACTICES
Advanced Techniques.
Consider these ones before migrating applications to Cloud.

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
24 Architectural Best Practices to follow before Migrating Line-of-
Business (LOB) Applications to Cloud.

Download:
http://msdn.microsoft.com/en-us/library/dn568099.aspx

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
FRE
Recommended
eBooks E
Download & Print.

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Best Practices to follow:

- Developer
- IT Professional
- Solutions Architect
- Recommended for ALL

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Introduction to Azure:

- Coming from Infra


background

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Introduction to Azure:

- Coming from Developer


background

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Best Practices while dealing with
Hybrid Cloud

- Coming from Senior Solutions


Architect // IT background

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Introducing Microsoft Azure
HDInsight

- Coming back Developer / Big


Data / BI backgrounds

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Best Practices to Migrate
Applications to Microsoft Azure

- Coming back Developer /


Architect backgrounds

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Best Practices to Building /
Architecting Cloud Applications for
Scale

- Coming back Developer /


Architect backgrounds
- BUT first basics of Azure must
be very clear

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
Workshop Deck
http://bit.ly/12SrwVd

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731
How do you copy?

Programming Azure Better, Best Practices & DevOps subhasishghosh2013@hotmail.com


+91-9916043731

You might also like