PowerShell Saturday #009 (Singapore) - Azure + PowerShell

Preview:

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

Azure + PowerShellPOWERSHELL SATURDAY #009 – 24TH MAY 2014

SINGAPORE POWERSHELL USER GROUP

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

Before Cloud

Introducing Cloud…

The CLOUD terms…

IaaS / PaaS / SaaS

Software-as-a-Service

consume

SaaSPlatform-as-a-Service

build

PaaSInfrastructure-as-a-Service

host

IaaS

Types of CLOUD

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.

Azure Services at a glance…

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

REST APIs

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

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

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..)

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

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.

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:

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.

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”

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”

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}

Stop all this boring stuffs…

The Mini Challenge

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.

Hmmm….

I can definitely do it!

With PowerShell vs Without PowerShell

Script: Simple way to create multiple VM

Are you CONVINCE?

To get you started with PowerShell on Azure…

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

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!

Recommended