azure powershell. azure automation

Download Azure Powershell. Azure Automation

Post on 16-Apr-2017

490 views

Category:

Engineering

2 download

Embed Size (px)

TRANSCRIPT

PowerPoint Presentation

Azure PowerShell SDK. Azure Automation.JANUARY 13, 2016

Alex Feshchenko,SENIOR SOFTWARE ENGINEER

#CONFIDENTIAL

1

AGENDA

PowerShell Basics

1Azure RM module

2Build automation with VSO

3Azure Automation

4Demo

5Q&A

6

#CONFIDENTIAL

2

Powershell basicsJANUARY 13, 2016

#CONFIDENTIAL

3

PowerShell

Command line and scripting language- As interactive and composable as BASH/KSH- As programmatic as Perl/Python/Ruby- As production oriented as AS400 CL/VMS DCL

#CONFIDENTIAL

4

Cmdlets

We use cmdLets or say Command-LetsCmdlet is made of Verb-Noun Syntax

e.g. SharePoint-Rocks No spaces in cmdLets

ExamplesGet-Help, Stop-Service, Restart-Computer, Get-Command VerbsNounsGetProcessStopServiceStartComputerGetHelpSetLocation

#CONFIDENTIAL

5

PowerShell Core Scripting

BasicsVariablesObjectsPipelineAliasesTab completion

Selection & FilterGet-MembersSelectWhereWhere-ObjectFilter

#CONFIDENTIAL

6

The Pipeline

PowerShell has an extremely powerful pipeline that works unlike anything thats really been done beforeIt carries the output of one command to the input of the next but it does so in an amazingly flexible wayIf you can master the pipeline (and the help system helps!)

#CONFIDENTIAL

7

Pipeline Example

#CONFIDENTIAL

8

Objects

You may have heard that PowerShell is an object-oriented shellPeople make a big deal of this because it enables a lot but conceptually its pretty simpleEver see an Excel spreadsheet? Its just a data structure, right? Well, thats all objects are. Data structures, in memory. Every PowerShell command (well, most) produces objects and PowerShell will even show you everything about them

#CONFIDENTIAL

9

Directly Using .NET Resources

Pre-loaded assemblies [AppDomain]::CurrentDomain.GetAssemblies()

[AppDomain]::CurrentDomain.GetAssemblies() | `ForEach-Object ` { if ($_.GlobalAssemblyCache){ $_.Location.ToString().Split("\")[4]}}SystemSystem.DrawingSystem.XmlSystem.ConfigurationSystem.Management.AutomationMicrosoft.PowerShell.Commands.UtilityMicrosoft.PowerShell.ConsoleHostMicrosoft.PowerShell.Commands.ManagementMicrosoft.PowerShell.SecuritySystem.Web.Services

#CONFIDENTIAL

10

Creating An Instance

#CONFIDENTIAL

11

Getting Help in PowerShell

Get-Help or Help

Get-Help Get-ProcessGet-Help Get-Process examplesGet-Help Get-Process DetailedGet-Help Get-Process -FullExamplesHelp Get-Process -Full

#CONFIDENTIAL

12

Azure rm moduleJANUARY 13, 2016

#CONFIDENTIAL

13

Microsoft Azure SDK

https://goo.gl/VhU2cO

#CONFIDENTIAL

14

Logging in to Azure Account

PS C:\> Login-AzureRmAccount

#CONFIDENTIAL

15

More specific queries

PS C:\> ((Get-AzureRmResourceProvider -ProviderNamespace Microsoft.Web).ResourceTypes | Where-Object ResourceTypeName -eq sites).LocationsBrazil SouthEast AsiaEast USJapan EastJapan WestNorth Central USNorth EuropeSouth Central USWest EuropeWest USSoutheast AsiaCentral USEast US 2

#CONFIDENTIAL

16

Create a resource group

PS C:\> New-AzureRmResourceGroup -Name TestRG1 -Location "West US"

ResourceGroupName : TestRG1Location : westusProvisioningState : SucceededTags :Permissions : Actions NotActions ======= ========== *

ResourceId : /subscriptions/{guid}/resourceGroups/TestRG1

#CONFIDENTIAL

17

Get available API versions for the resources

PS C:\> ((Get-AzureRmResourceProvider -ProviderNamespace Microsoft.Web).ResourceTypes | Where-Object ResourceTypeName -eq sites).ApiVersions2015-08-012015-07-012015-06-012015-05-012015-04-012015-02-012014-11-012014-06-012014-04-01-preview2014-04-01

#CONFIDENTIAL

18

Deploy the template

PS C:\> New-AzureRmResourceGroupDeployment -ResourceGroupName TestRG1 -TemplateFile c:\Azure\Templates\azuredeploy.json

#CONFIDENTIAL

19

Dynamic template parameters

PS C:\> New-AzureRmResourceGroupDeployment -ResourceGroupName TestRG1 -TemplateFile c:\Azure\Templates\azuredeploy.json -hostingPlanName freeplanwest -serverName exampleserver -databaseName exampledata -administratorLogin exampleadmincmdlet New-AzureRmResourceGroupDeployment at command pipeline position 1Supply values for the following parameters:(Type !? for Help.)administratorLoginPassword: ********

#CONFIDENTIAL

20

Get information about your resource groups

PS C:>Get-AzureRmResourceGroupGet all of the resource groups:To get the resources in the resource group, use the Find-AzureRmResource cmdlet and its ResourceGroupNameContains parameterPS C:\> Find-AzureRmResource -ResourceGroupNameContains TestRG1

#CONFIDENTIAL

21

Modify Resource Group

PS C:\> $resource = Get-AzureRmResource -ResourceName ExampleApp -ResourceGroupName OldRGPS C:\> Move-AzureRmResource -DestinationResourceGroupName NewRG -ResourceId $resource.ResourceIdMove resources from one group to another:Delete resource from Resource Group:PS C:\> Remove-AzureRmResource -Name TestSite -ResourceGroupName TestRG1 -ResourceType "Microsoft.Web/sites" -ApiVersion 2015-08-01Delete Resource Group:PS C:\> Remove-AzureRmResourceGroup -Name TestRG1

#CONFIDENTIAL

22

DEMOJANUARY 13, 2016

Deploying resources with ARM

#CONFIDENTIAL

23

DEMOJANUARY 13, 2016

Build automation

#CONFIDENTIAL

24

Azure automationJANUARY 13, 2016

#CONFIDENTIAL

25

What is Azure Automation?

Microsoft Azure Automation provides a way for users to automate the manual, long-running, error-prone, and frequently repeated tasks that are commonly performed in a cloud and enterprise environment. It saves time and increases the reliability of regular administrative tasks and even schedules them to be automatically performed at regular intervals

#CONFIDENTIAL

26

Azure Automation Capabilities

Azure

Monitoring Systems

Change Control Systems

Anything Runbook Authoring in Azure:Create runbooks to automate all aspects of cloud operations, from deployment, monitoring, and optimizations

Highly Available Engine:Support requirements for scale and H/A.Built on PowerShell Workflow. Isolation for runbook jobs

Integration into other systems:Import PS modules and create additional modules and runbooks for Azure services or to connect into 3rd party systemsAutomation

Backup SQL Azure on a scheduleStaged deployment of a serviceRemediate alert on a servicePatch Azure VMs without downtime

2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.1/12/201627

Pricing

Pricing Tiers:FreeBasic

#CONFIDENTIAL

28

Typical Azure Automation Scenarios

Patch Azure IaaS VMs without downtime, leveraging Traffic manager.

Enable regeneration of storage account keys while avoiding downtime in the application.

SQL Backup on a schedule.

Backup and restore IaaS VMs.

Deploy a VM on an Azure / On-Premise cloud and enable monitoring for the VM.

Deploy a new service to Azure and configure the end points for CPU and Memory alerts.

Deploy application from Git, run validation tests, and swap to production if tests pass.

Monitor SharePoint online for an approval to update a service and update the service once approved.

Alert on a VM then turn on tracing, collect logs, upload to Azure Storage and make available in Visual Studio for troubleshooting.

Monitor for when a new service gets created, and configure it for the right tracing / backup policy.

Notify users of a subscription who have underutilized VMs and perform remediation.Patch / Update / Backup OrchestrationChange Control & ProvisioningMonitoring & Remediation

2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.1/12/201629

Automation Accounts & DashboardCreate Automation AccountsOrganize your automation by group or individual contributorAccounts can live in different regionsCreate up to 30 accounts

Use Aut

Recommended

View more >