39
aO S 201 7 Canadian Tour Fueled by Quebec Montre al Ottawa Toront o February 6 February 7 February 8 February 10

Aos canadian tour (YOW) @energizedtech - Manage AzureRM with powershell

Embed Size (px)

Citation preview

Page 1: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

aOS 2017Canadian Tour

Fueled by

QuebecMontrealOttawaToronto

February 6February 7 February 8February 10

Page 2: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

Manage AzureRM Virtual Machineswith PowerShell

Using the Windows PowerShell Cmdlet to Manage, Access and Control Resources in

the Azure Resource ModelSean Kearney @energizedtech

Senior Solutions ArchitectCistel Technology Inc.

Page 3: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

Thank you !

Page 4: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

Get-Content 'C:\Sean Kearney.txt'• Sean Kearney – MVP Sean Kearney is a Senior Solutions Architect at Cistel

Technology Inc. He lives in the world of Automation leveraging technologies providing Automation to clients in whatever way shape or form he can. He will break out into song when the word “PowerShell” is used.

He is a Windows PowerShell MVP, Charter Member of the Springboard Technical Experts Program and an Honorary Scripting Guy who regularly contributes content to Microsoft's own "Scripting Guys" website.

In his spare time, he composes songs and Holiday specials about PowerShell and is working on a sonnet about Satya Nadella.

What can we say, he’s a complete Nerd about technology and he loves it.

• You can reach him at [email protected] / [email protected] Twitter @energizedtech – He’s on that Facebook and LinkedIn thing too ;) .

Page 5: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

On the Agenda

• High level view of Azure and IAAS• Visiting the AzureRM Modules and Cmdlets• Preparing your Virtual Machine Infrastructure• Creating your Virtual Machines• Obtaining Azure Resources• Using Azure Automation

Page 6: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

Microsoft AzureOverview Azure IAAS

Page 7: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell
Page 8: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

What *IS* Azure IAAS?

• Remotely Hosted Highly Scalable Virtualization Datacenter

• Plenty of Virtual Machine Templates provided

• Supporting Windows and various versions of Linux as well as Oracle

• Works with PowerShell Desired State Configuration files (DSC) and other technologies such as Chef

Page 9: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

Automation Options

• Windows PowerShell Cmdlets

• PowerShell Workflows

• Azure Automation Services

Page 10: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

Available Cmdlets

• Almost everything in Microsoft Azure has Cmdlets

• Current List http://bit.ly/AzureCmdletList

• www.powershellgallery.com• Search AzureRM download and install• Presently 27 Modules classified by purpose• 884 Cmdlets at your disposal (*klunk!*)

Page 11: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

Available Modules

AzureRM.ApiManagement AzureRM.HDInsight AzureRM.Resources

AzureRM.Automation AzureRM.Insights AzureRM.SiteRecovery

AzureRM.Backup AzureRM.KeyVault AzureRM.Sql

AzureRM.Batch AzureRM.Network AzureRM.Storage

AzureRM.Compute AzureRM.NotificationHubs AzureRM.StreamAnalytics

AzureRM.DataFactories AzureRM.OperationalInsights AzureRM.Tags

AzureRM.DataLakeAnalytics AzureRM.profile AzureRM.TrafficManager

AzureRM.DataLakeStore AzureRM.RecoveryServices AzureRM.UsageAggregates

AzureRM.Dns AzureRM.RedisCache AzureRM.Websites

Page 12: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

Connect to Azure RM with PowerShell

Page 13: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

Azure Virtual MachinesBuild your Base Infrastructure

Page 14: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

Build Your Base Infrastructure

• On Premise Solution Requirements

• Servers and Storage

• Networking

Page 15: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

Build Your Base Infrastructure

• Azure Virtual Machine Requirements

• Servers and Storage

• Networking

• Service Point

Page 16: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

Build Your Base Infrastructure

• Azure Virtual Machines

• Define Azure Resource Group• Location, Reference Name

• Define our Storage• Location, Reference Name, Storage Type

• Define our Network• Virtual Network - Location, Resource Name, Address Range/Subnet• Virtual Network Subnet – Resource Name, Address Range/Subnet

Page 17: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

Build Your Base Infrastructure

• Azure Virtual Machines using Windows PowerShell

• Define Azure Resource Group• New-AzureRM

• Define our Storage• New-AzureRMStorage

• Define our Network• New-AzureRMVirtualNetworkSubnetConfig• New-AzureRMVirtualNetwork

Page 18: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

Build your Base Infrastructure

Page 19: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

Azure Virtual MachinesCreating a Virtual

Machine

Page 20: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

Creating a Virtual Machine

• On Premise Solution Requirements

• Operating System• Memory• Virtual Disk(s)• CPU Count and Speed• Network Connection(s)• Virtual Network Wire• Firewall Rule(s)

Page 21: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

Creating a Virtual Machine

• Azure Virtual Machine Requirements

• Operating System• Memory• Virtual Disk(s) (Cannot Assign Letter D)• CPU Count and Speed• Network Connection (Dynamic IP)• Virtual Network Wire• Firewall Rule(s)

Page 22: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

Creating a Virtual Machine

• Azure Virtual Machines

• Quick Create or From Gallery• DNS Name• O/S Image• Size (Predefined VM Template config)• UserName (Default Admin)• Password (Default Password)• Location

Page 23: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

Creating a Virtual Machine

• Azure Virtual Machines using PowerShell

• Create AzureRM Configuration• New-AzureRMVMConfig

• Create network card• New-AzureRMPublicIPAddress, New-AzureRMNetworkInterface, Add-AzureRMVMNetworkInterface

• Define Operating System• Set-AzureRMVMOperatingSystem, Set-AzureRMVMSourceImage

• Define attached OS Disk and Data Disk• Set-AzureRMVMOSDisk, Set-AzureRMVMDataDisk

• Create Firewall Rules• New-AzureRMNetworkSecurityRuleConfig• New-AzureRMNetworkSecurityGroup

• Create the Virtual Machine• New-AzureRMVM

Page 24: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

Creating a Virtual Machine

• A quick way to grab the JSON configuration

• Get-AzureRMVM• Set-AzureRMVM –generalized• Save-AzureRMVM

• *OR*

• View before provisioning in AzureRM GUI Portal

Page 25: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

Creating a Virtual Machine

Page 26: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

Azure Virtual MachinesAzure Resources through

PowerShell

Page 27: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

Azure Resources through PowerShell

• Resources you will need to get names for

• Virtual Machine Template name / VHD Filename• Geographic Locations• Virtual Machine Role Sizes• Service Names• Storage Accounts• Networks

Page 28: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

Azure Resources through PowerShell

• Access those needed resources with Cmdlets

• Get-AzureRMVMImage• Get-AzureRMResourceGroup• Get-AzureRMStorageAccount• Get-AzureRMVirtualNetwork• Get-AzureRMNetwork• Get-AzureRMVM• Access properties of a VM to get all resource data

Page 29: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

Azure Resources through PowerShell

Page 30: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

Azure Virtual MachinesLeveraging Azure

Automation

Page 31: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

Virtual Machine States

• Three possible states• Running

• Operating System is up and Resouces Allocated• Costing Money

• Deallocated• Operating System is down and Resourcs are Deallocated• Not Costing Money

• StoppedVM• (Operating System if off, Resources are still Allocated)• Costing Money

Page 32: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

Scheduling PowerShell Scripts

• On Premise Server connecting through the Internet• Requires Internet• Scripts can be used immediately

• Azure Automation hosted within Azure• No Internet required• Some reconfiguration needed

Page 33: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

Using Azure Automation

• Build an Automation account

• Create Automation Credentials

• Populate Scripts within the Runbook

• Build Variables within Azure Automation

• Setup a schedule

Page 34: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

Leveraging Azure Automation

Page 35: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

Take aways

• AzureRM Virtual Machines are just Hyper-V “in the cloud”

• You can access all resources from just PowerShell alone

• Create a Virtual Machine in the Web console first, then use PowerShell to identify all your needed Azure resources

• Azure Automation allows you to schedule and manage Virtual Machines without the need for Internet

Page 36: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

Questions?

Page 37: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

Azure PowerShell Resources

• Sample JSON Templates for AzureRM• http://bit.ly/AzureRMJson

• Azure RM Cmdlets• http://bit.ly/AzureRMPowerShell• http://bit.ly/GHAzureRM

• Scripting Guys articles on Azure Automation• http://bit.ly/PowerShell-AzureAutomation

• Look for a series on Azure RM and Virtual Machines with PowerShell THIS Month on Scripting Guys!

Page 38: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

Thanks Everybody!

• www.powershell.org• www.scriptingguys.com

• Download Sample PowerShell scripts here forPresentation

• https://1drv.ms/u/s!Aknz413LlS-VkJ4q3TWnUIhWm-daAA

• Email:[email protected] www.cistel.com• Email:[email protected] www.powershell.ca• Twitter: @energizedtech

Page 39: Aos canadian tour (YOW)  @energizedtech - Manage AzureRM with powershell

Thank you !