Programming Microsoft Azure PDF
Programming Microsoft Azure PDF
Better,
Best Practices & DevOps
Subhasish Ghosh
Director, CloudCover.In Dec 8-12 2014
@nerdometer Microsoft,
Hyderabad
Programming Azure Better, Best Practices & DevOps [email protected]
+91-9916043731
Contact
e: [email protected], [email protected]
m: +91-9916043731
LinkedIn: https://www.linkedin.com/in/sghosh2011
Skype: pink_floyd2008
• 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 [email protected]
+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
http://msopentech.com/
http://msopentech.com
/
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 [email protected]
http://msopentech.com
/
Press F5
Runs OWIN app using
System.Web
(IIS/ASP.NET)
• 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 [email protected]
+91-9916043731
Take Home Challenge! Solution
Enabling Trace Warning on Cloud using VS2013
• 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 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.
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
[email protected]
+91-9916043731 method that called
Programming Azure Better, Best Practices & DevOps [email protected]
+91-9916043731
Properties
- async code is NOT multi-threaded code
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.
Inside “ExpenseReports” go to “Users” and then select Iam (i.e. [email protected]) and ASSIGNED
= YES.
• 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 [email protected]
+91-9916043731
Recap
Day 1 & Day 2
MISSING –
Horizontal
Vertical
Partitioning
Partitioning
(SHARDING)
- Semantics
Compute
- Scale Average Usage
- Queries Time
“Predictable Bursting“
- Analytics
- Real-time
Compute
Average Usage
Time
• Select MVC, OK
• This creates the project
Name it
“HelloWorldHyderabad
Controller”.
Programming Azure Better, Best Practices & DevOps [email protected]
+91-9916043731
Open App_Start RouteConfig.cs
Controller = should be same as
controller name in .cs
• 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 [email protected]
+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.
- 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
[email protected]
+91-9916043731
Lab #4
Creating a Cache for Azure Managed Cache Service using Azure
PowerShell cmdlets. Connecting to this MCS from a client application.
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:
#install-package
Microsoft.Web.RedisSessionStateProvider
Programming Azure Better, Best Practices & DevOps [email protected]
+91-9916043731
Using Redis Cache in Code
Check Web.config file
MyFixIt Application
MyFixIt DB
Web Server
MyFixIt DB
MyFixIt Application
Web Server Queue Listener
Task Queue
Task Queue
Queue Listener
Queue successfully handles
burst
• 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 [email protected]
+91-9916043731
Design to Survive Failures
Code in final
testing
Features being
Integrated
Code in final
testing
• Confidence
• Agility
• Less Prone to
Errors
Programming Azure Better, Best Practices & DevOps [email protected]
+91-9916043731
Using Distributed Source
Control
• Git
• Mercurial
• TFS
• Web.config stores 2
connection strings for
Microsoft Azure
password and the key to an
Azure storage account
Lab #7
• Explore Branches, Merging etc.
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 [email protected]
+91-9916043731
Lab #9
Staged Deployment in Azure Web Sites with GitHub
Integration
- 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.
• 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 [email protected]
+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
Download:
http://msdn.microsoft.com/en-us/library/dn568099.aspx
- Developer
- IT Professional
- Solutions Architect
- Recommended for ALL