Automating Your Microsoft Azure Environment (DevLink 2014)

Preview:

DESCRIPTION

Discussion of various automation options available in the Microsoft Azure platform - Azure Automation, PowerShell, Azure Management Libraries, Azure Resource Manager, and Brewmaster.

Citation preview

Automating Your Microsoft Azure Environment

Michael S. CollierPrincipal Cloud Architect

michaelc@aditi.com@MichaelCollierwww.MichaelSCollier.com

17

COLUMBUS, OH OCTOBER 17, 2014 CLOUDDEVELOP.ORG

Today’s Agenda1. Why Automation in Azure2. Azure Management Library3. PowerShell4. Azure Automation5. Brewmaster*

* I am employed by Aditi. Brewmaster is an Aditi service.

Why Automation?Azure is highly automated• Service healing• Internal resources

Time to provision full environments• Compute, storage, etc.

Deployment to multiple geographies• Change only configuration / parameters

Why Automation?

#1 Source of Failed Projects (IMO)

Humans Terrible at Repetitive Tasks

A Few Options

REST API• Service Management

• Resource Manager

A Few Options

REST API• Service Management

• Resource Manager

Azure Management Library

A Few Options

REST API• Service

Management• Resource

Manager

Azure Management Library

PowerShell• Invoke REST• Service

Management• Resource

Manager

A Few Options

REST API• Service

Management• Resource

Manager

Azure Management Library

PowerShell• Invoke REST• Service

Management• Resource

Manager

XPlat CLI• ??

A Few Options

REST API• Service

Management• Resource

Manager

Azure Management Library

PowerShell• Invoke REST• Service

Management• Resource

Manager

XPlat CLI• ??

Azure Automation

A Few Options

REST API• Service

Management• Resource

Manager

Azure Management Library

PowerShell• Invoke REST• Service

Management• Resource

Manager

XPlat CLI• ??

Azure Automation

Brewmaster

Microsoft Azure Management Library

Microsoft Azure Management LibraryConsistent modern libraries over the Azure REST API

Source: http://www.BradyGaster.com

Microsoft Azure Management Library

Source: http://www.BradyGaster.com

Microsoft Azure Management LibraryScenarios• Integration Testing• Custom provisioning of services (SaaS)• Dev/Test• Resource Governance

• Anything you may want to automate

Microsoft Azure Management LibraryGet all or just the ones you need

MAML

Create Web SiteCreate Storage AccountCreate and Deploy Web Role

• Get the MAML Libraries from NuGet• Microsoft.WindowsAzure.Management

• Get Active Directory Authentication Library• Microsoft.IdentityModel.Clients.ActiveDirectory (search “ADAL”)

• Authenticate against AAD or use ClientCredential• Use Microsoft Account or Organization

• Use resource specific client to perform actions• StorageManagementClient, ComputeManagementClient, etc.

Recap

PowerShell

PowerShell CmdletsGet the goods

http://azure.microsoft.com/en-us/downloads/

https://github.com/Azure/azure-sdk-tools/releases

PowerShellUse cmdlets and/or REST APIs

Ability to script complex environments• Template with an XML parameters file• PowerShell learning curve

Consistent Deployments• Build server or developer machine

Authentication OptionsInteractive• Azure AD

> Add-AzureAccountVERBOSE: Account "michael.collier@live.com" has been added.VERBOSE: Subscription "Cloud Practice Sales Demos" is selected as the default subscription.VERBOSE: To view all the subscriptions, please use Get-AzureSubscription.VERBOSE: To switch to a different subscription, please use Select-AzureSubscription.

* Tip – Profile data stored in C:\Users\<user>\AppData\Roaming\Windows Azure Powershell

Authentication OptionsProgrammatic• Management certificate• New –credentials option

$userName = "<your organizational account user name>"

$securePassword = ConvertTo-SecureString -String "<your organizational account password>" -AsPlainText -Force

$cred = New-Object System.Management.Automation.PSCredential($userName, $securePassword)

Add-AzureAccount -Credential $cred http://azure.microsoft.com/en-us/documentation/articles/install-configure-powershell/

PowerShell:Service Management

Create VMs with custom script extensionDeploy a Cloud Service

Resource ManagerWhat is Azure Resource Manager?

Resource Group

Unit of Management• Lifecycle• Identity• Grouping

One Resource -> One Resource Group

RepeatabilityProvide• Idempotency• Orchestration• Resource configuration

Ability To• Source control• Parameterized input/output

SQL - A Website VirtualMachines

SQL-AWebsite

[SQL CONFIG] VM (2x)

DEPENDS ON SQLDEPENDS ON SQL

SQLCONFIG

Image source - http://channel9.msdn.com/Events/Build/2014/2-607

JSON Templates

What You NeedAzure Resource Manager Tools Preview (VS2013)

What You NeedPowerShell (v0.8.7.1)

Switch-AzureMode AzureResourceManagerGet-AzureResourceGroupGalleryTemplate –Identity

Microsoft

PowerShell:Resource Manager

Create new deployment from gallery (WebSite + SQL)

Create customized image(WebSite + SQL + Redis + WebDeploy)

Azure Automation

What is Azure Automation?IT process automation solution for Azure• Creation, monitoring, deployment, & maintenance• PowerShell Workflow engine• Runbooks• Leverage existing PowerShell scripts

Azure Automation

Stop VMs on a Schedule

Brewmaster

BrewmasterAutomated provisioning and deployment in Azure1. Choose Template 2. Configure

Parameters3. Deploy

Brewmaster TemplatesPre-built templates for popular server workloadsSharePoint, AD, SQL Server Always On, ARR, etc.DSC and PowerShell

Template SDKhttps://github.com/AditiTechnologiesJSON-basedC# Fluent Syntax Builder (NuGet)

Brewmaster

Create SQL Server AlwaysOn deployment

Choices . . . When to UseMAML

• PCL (WinPhone/WinStore)

• Higher level languages

PowerShell

• DevOps• Templates• Build Servers• Quicker than portal

Azure Automation

• Schedule Tasks• Integrate with Other

Services• System Center scripts

Brewmaster

• Templates for server workloads

• IaaS-only

Azure Resource Manager

• Future for Azure API• New, well-defined

topology• Unable to export from

cloud

ResourcesMAML• http://www.jeff.wilcox.name/2014/04/wamlmaml/ • http://

www.bradygaster.com/post/announcing-the-general-availability-of-the-microsoft-azure-management-libraries-for-net

PowerShell• ARM - http://channel9.msdn.com/Events/Build/2014/2-607 • http://michaelwasham.com/windows-azure-powershell-reference-guide/

Azure Resource Manager• http://azure.microsoft.com/blog/2014/08/11/azure-resource-manager-tools-preview/• http://

blogs.msdn.com/b/rmattsampson/archive/2014/08/19/azure-resource-manager-tools-for-visual-studio.aspx

Azure Automation• http://azure.microsoft.com/blog/tag/azure-automation/

Brewmaster• http://brewmaster.aditicloud.com

Questions?

Thank You!Michael S. CollierPrincipal Cloud Architect

michaelc@aditi.com@MichaelCollierwww.MichaelSCollier.com

Recommended