Tom Lee - Doing Azure with Powershell

Post on 17-Jan-2017

19 views 3 download

Transcript of Tom Lee - Doing Azure with Powershell

DOING AZURE WITH POWERSHELLThomas LeePS PartnershipPartnerDoctorDNS@Gmail.Com

Who Am I?I am Thomas Lee - Partner at PS Partnership17 Time MVP, MCT, etcI tweet from @DoctorDNSI blog at http://tfl09.blogspot.comEmail me DoctorDNS@GMail.ComWhen not tweeting/blogging I like to listen to my large collection of Grateful Dead live show recordings.I blog, tweet, teach, and support Azure and PowerShell

AGENDA

What IS PowerShell? What is Azure? Getting started and setup Creating Virtual Machines using PowerShell Creating Virtual Networks using PowerShell Creating File Storage in Azure using PowerShell

BEFORE WE START…

The slides and demo files for this talk are shared on Dropbox: http://bit.ly/ucdayfiles

Enjoy!!

Silver Sponsors

Gold Sponsors

Bronze Sponsors

WHAT IS POWERSHELL?

POWERSHELL IS…

Microsoft’s strategic task automation platformfor IT Pros

Cmdlets

Objects

Pipeline

Community

Discovery

PowerShell Language Features

LOOKING AT POWERSHELL

POWERSHELL CMDLETS These are tiny programs that do the work

All the rest is syntax, syntax, syntax Cmdlets come from many places

Built-in Included with Windows features Included with applications Commercial Community (PowerShell Gallery)

PowerShell cmdlets distributed as Modules Getting key modules is easy with PowerShell Gallery and PSGet

OBJECTS

PowerShell Cmdlets produce and consume objects Objects are based on .NET

.NET Objects are native WMI/CIM objects are COM data wrapped in .NET Object COM objects are adapted

See the output of a cmdlet by piping it to Get-Member Azure object documentation is evolving

THE PIPELINE

The output of one command becomes the input to the next command

Base on Linux/Unix Pipeline But based on objects not raw text No prayer-based parsing

Extremely powerful in operation

SYNTAX, SYNTAX, SYNTAX

PowerShell is a programming/scripting language It has syntax – and you need to learn it

Syntax errors usually easy to troubleshoot Good error messages for the most part

Errors using cmdlets can be harder to troubleshoot Some Azure cmdlet messages are cryptic If stuck – there are places you can get help like Spiceworks.Com

WHAT IS AZURE?

Do I even need to ask?

AZURE

Microsoft operateddata centre in the cloud

WINDOWS AZURE SERVICES

You canmanage Azure

using PowerShell

USING CMDLETS AGAINST AZURE

You can use PowerShell cmdlets to manage almost all Azure resources

The cmdlets are a wrapper around the underlying REST based APIs

The cmdlets have changed a lot and continue to be improved The Story of Two APIs and cmdlets to suit each

GETTING STARTED

BEFORE WE CAN MANAGE AZURE You need to setup your management environment

Install latest updates Setup your desktop Update $Profile with useful commands

For this talk, I created a new Outlook.com account (UCDay100@Outlook.Com) and a trial Azure account for this email address

FOR OUR DEMOS

C:\Foo setup as location to put scripts, etc. Added a $Profile for both ISE and Console Create Personal Modules drive Also

Turned off IE Protected mode Update-Help

GETTING AZURE MODULES You need to find, then get and install the cmdlets

Use Find-Module to find Azure modules (On PSGallery) This requires you also installing the NuGet Provider

For this talk, we are using the PowerShell gallery as the source of the cmdlets

There are other places, but PowerShell Gallery is easy with PowerShellGet module

Once you download the cmdlets, ensure you update help Update-Help

FINDING MODULES

INSTALLING MODULES Azure Service Management API based cmdlets

Azure module Azure Resource Manager API based cmdlets

AzureRM module(s)

Modules and contained Cmdlets change regularly Changes are versioned You can update using Update-Module

GETTING SETUP IN AZURE

Download/Install the cmdlets Login to Azure Create Resource Group(s) and Storage Account(s) Create some tags And get more familiar with the Azure cmdlets

Demo 0Getting Started with Azure

CREATING VIRTUAL MACHINES AND NETWORKS

CREATING A VIRTUAL NETWORK

Define Azure subnets New-AzureRmVirtualNetworkSubnetConfig

Create the virtual network New-AzureRMVirtualNetwork

CREATING A VIRTUAL MACHINE IN THE VNET First create a VMConfig object

New-AzureRmVmConfig Use cmdlets to add configuration items to this config object

Set-AzureRmVMOperatingSystem Set-AzureRmVMSourceImage Add-AzureRmVMNetworkInterface Set-AzureRmVMOSDisk

Create the VM using the VM config object New-AzureRmVM

Demo 1Creating a Virtual Network and a VM

THINGS YET TO DO That demo created a VPN, but without a VPN gateway To create the gateway you need to both create a gateway and

configure your local end For Site to Site VPNs, you need to setup your VPN server For Point to Site VPNs, you need to download and install the client

P2S is easy to setup but You have to manually install the VPN client (you can automate the

download!) You have to manually turn the VPN on (Rasdial does not work to connect

to the VPN) There is an additional demo that can show this – if we get time…

AZURE FILES

AZURE FILES

Provides SMB based storage in Azure Great for apps you want to move to the cloud with minimal

change You set up using some simple PowerShell – or the GUI if you

must! Most of the automation is actually pretty easy

You access it using standard tools and drive mappings Use PowerShell to setup the share, then use standard commands

and cmdlets to manage/use the file store It feels very familiar in usage

CREATING A FILE SHARE IN AZURE

Create an Azure storage account to hold the files (done already for the VM)

Get storage account key and storage account context Then create a new Azure Storage Share Once related, you can use New-SMBMapping to create a local

drive mapping

Demo 2Creating and Using an Azure File Share

SUMMARY

Using Azure with PowerShell is easy Creating a virtual network Creating a virtual machine Using Azure files

The cmdlets are in a state of constant change Test updates carefully Watch for the updates and what new features they bring

You can easily automate almost of all the things you can do with/on/to Azure

“”

LEARN POWERSHELL OR LEARN TO SMILE AS YOU SAY ‘WOULD YOU LIKE FRIES WITH THAT BURGER?’

Thomas Lee or Don Jones

QUESTIONS/ANSWERS