Microsoft Ignite NZ 25-28 October 2016 SKYCITY, Auckland
Automating Azure IaaS with PowerShell - Beyond the Azure PowerShell Module Neil Peterson @nepeters
Session Topics Azure PowerShell Module Azure VM Custom Script Extension Azure VM DSC Extension Azure Automation
Azure PowerShell Module
Azure PowerShell Module - update Current Version 3.0 Replaces 9.8 and introduces multiple modules (Azure and Azure RM). Switch-AzureMode has been removed.
What is Azure Resource Manager Azure Assets grouped into Resource Groups Unified management of related assets (delete, tag, ACL, etc..) Declarative model deployment JSON Template Visual Studio Integration While we can still deploy assets with PowerShell Commands, we can also deploy Resource Groups via PowerShell using the JSON template.
DEMO – Azure PowerShell Module
Azure VM Agent
Azure VM Agent Lightweight process used to manage VM Extensions Optional Extension to Azure VM Enabled by default Support for Windows and Linux
Azure VM Extensions Provide dynamic features, supplied by Microsoft and third parties, executed by the Azure VM Agent. Azure VM Agent installs, configure and execute extensions Extensions added through portal, PowerShell, or Azure CLI Can be run against existing or new VM’s
Sample Extensions Custom Script Extension – executes PowerShell script locally on the VM. DSC Extension – PowerShell DSC Extension. BgInfo Extension – enabled by default, installs and configures Sysinternals BgInfo. Access Extension – manage remote desktop and local administrator account. Chef Extension – creates a Chef client. Diagnostic Extension – enables, disables and configures Azure diagnostics. MS Enterprise Application Extensions – implements features supported by System Center. Puppet Extension – implements Puppet features.
VM Custom Script Extension
Azure VM Custom Script Extension Scripts copied to VM and executed locally. Prerequisites: Azure VM Agent must be running. Must be using Azure PS module 8.0 or higher. Scripts must be uploaded to blob storage or accessible location (GitHub). Multiple script’s must be ‘chained’ in code, only one is executed by extension.
Azure VM Custom Script Extension Why Azure VM Custom Script Extension: Execute scripts on existing Azure VMs without the need of an Endpoint or PowerShell Remoting. Execute script on new VM’s at build time. Process: Create script and upload to Azure Blob storage or other storage. Use Set-AzureRMVMCustomScriptExecution to execute script.
DEMO – VM Custom Script Extension
VM DSC Extension
PowerShell DSC PowerShell language extension used to declaratively specify, apply and maintain software configuration. Examples Use Cases: Enable server roles and features Manage registry, WMI, files and folders Manage User, Groups, and Security Deploy Software Detect and remediate configuration drift
Azure VM DSC Extension Upload and apply a PowerShell DSC configuration to a new or existing Azure VM. Prerequisites: Azure VM Agent must be running. Must be using Azure PS module 8.0 or higher. DSC configuration script and DSC resources must be published to Azure blob storage or other accessible location (GitHub). VM PowerShell DSC extension must be configured on VM.
Azure VM DSC Extension Why Azure DSC Extension: Apply DSC configuration to existing VM. Apply DSC configuration to new VM’s at build time – think about the possibilities. Process: Create DSC configuration. Publish configuration to Azure using Publish-AzureRMVMDscConfiguration. Execute using Set-AzureRMVMDscExtension. Monitor application using Get-AzureRMVMDscExtension.
DEMO – VM Extensions
Azure Automation
Azure Automation Introduction Azure automation is an Azure hosted Runbook / technical workflow system. Can be used for Azure management Jobs can be scheduled Automation language is PowerShell Workflow Contains secure repository for credentials and connection details
What is PowerShell Workflow 11/15/2018 What is PowerShell Workflow Introduced with PowerShell 3.0. Common PowerShell syntax and development experience. Utilizes Windows Workflow Foundation (WF). Includes capabilities that PowerShell does not: Checkpoint Suspend © 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.
Azure Automation Sample Stop all VM’s
DEMO – Azure Automation
11/15/2018 1:12 AM © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.