27
Azure + PowerShell POWERSHELL SATURDAY #009 – 24 TH MAY 2014 SINGAPORE POWERSHELL USER GROUP

PowerShell Saturday #009 (Singapore) - Azure + PowerShell

Embed Size (px)

DESCRIPTION

Presented in PowerShell Saturday #009 and 4th PowerShell Saturday in Singapore. This session is about Microsoft Azure and how you can use PowerShell to gradually help manage your services in Azure.

Citation preview

Page 1: PowerShell Saturday #009 (Singapore) - Azure + PowerShell

Azure + PowerShellPOWERSHELL SATURDAY #009 – 24TH MAY 2014

SINGAPORE POWERSHELL USER GROUP

Page 2: PowerShell Saturday #009 (Singapore) - Azure + PowerShell

Who is this guy? Milton Goh Developer / Systems Engineer at Dimension Data

Microsoft Community Contributor (MCC – TechNet)

Geek who loves meddling with technology… Especially… Power…. Shell….

Runs a blog that share a little about everything I do at www.miltongoh.com

Tweet at @miltongoh

Page 3: PowerShell Saturday #009 (Singapore) - Azure + PowerShell

Before Cloud

Page 4: PowerShell Saturday #009 (Singapore) - Azure + PowerShell

Introducing Cloud…

Page 5: PowerShell Saturday #009 (Singapore) - Azure + PowerShell

The CLOUD terms…

IaaS / PaaS / SaaS

Software-as-a-Service

consume

SaaSPlatform-as-a-Service

build

PaaSInfrastructure-as-a-Service

host

IaaS

Page 6: PowerShell Saturday #009 (Singapore) - Azure + PowerShell

Types of CLOUD

Page 7: PowerShell Saturday #009 (Singapore) - Azure + PowerShell

What is Azure?

Flexible

Open

Solid

Comprehensive set of services that enable you to quickly build, deploy and manage applications across a global network of Microsoft-managed datacenters.

Page 8: PowerShell Saturday #009 (Singapore) - Azure + PowerShell

Azure Services at a glance…

Page 9: PowerShell Saturday #009 (Singapore) - Azure + PowerShell

Managing Azure… You can manage Microsoft Azure via the following:

REST APIs

Command Line Tools Windows (PowerShell) Linux (Bash) Mac (Bash)

Page 10: PowerShell Saturday #009 (Singapore) - Azure + PowerShell

PowerShell… What can be manage?By using PowerShell, you can manage the following:

Affinity Groups

Certificates

Cloud Services

Subscriptions

Storage Accounts

Service Bus

SQL Databases

Virtual Networks

Virtual Machines

Web Sites

Page 11: PowerShell Saturday #009 (Singapore) - Azure + PowerShell

PowerShell… What can be done?

AutomationQuery, Manage and Configure Virtual Machines across multiple subscriptions, cloud services and storage accounts.

Virtual NetworkingCompletely Configure VNETs from a Script

Provision Fully Configured Virtual MachinesDomain JoinedStorage and Networking Configured

Remote ManagementManage SQL Databases, Configuration, Diagnostics, Deployments, and Azure assets (Affinity Groups, Storage Accounts, Keys, etc..)

Page 12: PowerShell Saturday #009 (Singapore) - Azure + PowerShell

Getting Started with Azure Subscription Credentials in PowerShell

1) Download the Microsoft Azure PowerShell Management Tools via http://mspro.sg/AzurePowerShellMgmtTools (Direct Link) or http://mspro.sg/AzureDownload

Page 13: PowerShell Saturday #009 (Singapore) - Azure + PowerShell

Getting Started with Azure Subsciption Credentials in PowerShell

2) Set execution policy on your local computer

3) Import Azure PowerShell Script ModuleImport-Module Azure.psd1

Alternatively, you may want to launch the “Windows Azure PowerShell” instead of the normal “Windows PowerShell” in order to skip this step.

Page 14: PowerShell Saturday #009 (Singapore) - Azure + PowerShell

Getting Started with Azure Subsciption Credentials in PowerShell

4) Download Azure Publisher Settings FileGet-AzurePublishSettingsFile

** Note ** This command will launch your browser and direct you to the Microsoft Azure Portal to sign in (if you are not signed in) to download the certificate.

Example of the downloaded file:

Page 15: PowerShell Saturday #009 (Singapore) - Azure + PowerShell

Getting Started with Azure Subsciption Credentials in PowerShell

5) Import the downloaded publishSettings file using the following command.Import-AzurePublishSettingsFile

** Note ** You may also change the subscription accordingly.

Page 16: PowerShell Saturday #009 (Singapore) - Azure + PowerShell

Azure Web Sites + PowerShell 1) Create new Azure Web Site

New-AzureWebsite –Name “Name of Website” –Location “Southeast Asia”

2) Create new Azure ServiceNew-AzureService –ServiceName “Name of Service” –Label “MyTestService” –Location

“Southeast Asia”

Page 17: PowerShell Saturday #009 (Singapore) - Azure + PowerShell

Azure Virtual Machine + PowerShell

1) First Virtual Machine in a NEW Cloud Service (-Location specified)New-AzureQuickVM -Windows -ServiceName “ServiceName” -Name “TestVM” -ImageName “Name of Image” -Location “Southeast Asia” -Password “youshouldnotknow”

2) New Virtual Machine in an Existing Cloud Service (no –Location)New-AzureQuickVM -Windows -ServiceName “ServiceName” -Name “TestVM” -ImageName “Name of Image” -Password “youshouldnotknow”

3) Creating a Linux Virtual Machine in an Existing Cloud ServiceNew-AzureQuickVM -Linux -ServiceName “ServiceName” -Name “TestVM” -ImageName

“Name of Image” -LinuxUser “admin” -Password “youshouldnotknow”

Page 18: PowerShell Saturday #009 (Singapore) - Azure + PowerShell

Azure Virtual Machine + PowerShell

1) Retrieve Cloud Services Get-AzureService

2) Retrieve Virtual Machines for Service Get-AzureVM -ServiceName “Cloud Service Name”

3) Retrieve Status for All VMs in SubsriptionGet-AzureService | foreach { $_ | Get-AzureVM | ft ServiceName, Name, InstanceStatus}

Page 19: PowerShell Saturday #009 (Singapore) - Azure + PowerShell

Stop all this boring stuffs…

Page 20: PowerShell Saturday #009 (Singapore) - Azure + PowerShell

The Mini Challenge

Page 21: PowerShell Saturday #009 (Singapore) - Azure + PowerShell

Milton, the development team needs 10 virtual

machines by end of day.

But… It’s 15 minutes to knock-off time and I have an appointment.

Page 22: PowerShell Saturday #009 (Singapore) - Azure + PowerShell

Hmmm….

I can definitely do it!

Page 23: PowerShell Saturday #009 (Singapore) - Azure + PowerShell

With PowerShell vs Without PowerShell

Page 24: PowerShell Saturday #009 (Singapore) - Azure + PowerShell

Script: Simple way to create multiple VM

Page 25: PowerShell Saturday #009 (Singapore) - Azure + PowerShell

Are you CONVINCE?

Page 26: PowerShell Saturday #009 (Singapore) - Azure + PowerShell

To get you started with PowerShell on Azure…

Hit http://mspro.sg/azurescriptcenter Now!

Page 27: PowerShell Saturday #009 (Singapore) - Azure + PowerShell

New-Question –Target “Audience”

Get-Answer

Thank you for listening to my ranting…

Brought to you by Singapore PowerShell User Group

Do you know about PowerShell Breakfast / PoSHBreakfast? Check out www.poshbreakfast.com NOW!