다음을 통해 공유


Modernizing Your Infrastructure with Hybrid Cloud - Getting Started with Automating the Hybrid Cloud using PowerShell (Part 24)

This article is Part 24 in the Modernizing Your Infrastructure with Hybrid Cloud series by our US IT Pro team.  After you read this article, be sure to catch the full series for more information and resources.

When migrating to Hybrid Cloud, developing automated standards for provisioning and managing application workloads is key to accelerating the predictable deployment of new business solutions.  As you begin developing scripts and workflows, being able to do so with consistency across on-premises datacenters and cloud platforms is important to promote reusability and agility when migrating these workloads.

image

Get Started with Hybrid Cloud Automation

Earlier this week in our Modernizing Your Infrastructure with Hybrid Cloud series, Yung Chou and I demonstrated the ability to leverage Windows PowerShell and the Azure PowerShell module as an easy way to get started with automation tasks for both Azure Pack private clouds and Microsoft Azure public clouds via the tenant service management API and PowerShell cmdlets.

So that you can follow along with this step-by-step demo, I’ve included the PowerShell snippets that we walked through in the section below.

PowerShell Snippets for Tenant API

To use the snippets below, you’ll need the following items to be setup in your environment:

  • An active Microsoft Azure subscription.  If you don’t currently have an active Microsoft Azure subscription, sign-up for a free trial subscription account.
     
  • Azure Pack in an on-premises private cloud environment.  To get started with your Azure Pack deployment, follow these steps.
     
  • The latest version of the Azure PowerShell module.  You can download and install this module from the Azure Download Center.

After you’ve confirmed that you’ve met these requirements, open your Windows PowerShell ISE and copy/paste the snippet below to follow along with the step-by-step demo referenced above.

# Display version of Azure PowerShell module
Get-Module -Name Azure

# Display Azure environments available
Get-AzureEnvironment

# Authenticate to Azure Add-AzureAccount

# Show available Azure subscriptions(Get-AzureSubscription).SubscriptionName

# List provisioned Azure VMs
Get-AzureVM

# Add new Azure environment for Azure Pack
Add-AzureEnvironment `
-Name "AzurePackOnPrem" `
-PublishSettingsFileUrl "https://kemlabwap01.kemlabdom01.keithmayer.com:30081/publishsettings"

# Authenticate to Azure Pack
Get-AzurePublishSettingsFile `
-Environment "AzurePackOnPrem"
Import-AzurePublishSettingsFile `
-PublishSettingsFile "E:\INSTALL\Developer Plan.publishsettings"

# Show available Azure subscriptions
(Get-AzureSubscription).SubscriptionName

# Select the Azure subscription associated with the Developer Plan
Select-AzureSubscription `
-SubscriptionName "Developer Plan"

# Get Windows Azure Pack VM names(Get-WAPackVM).Name

# Manage Windows Azure Pack resources
$vm = Get-WAPackVM -Name "dev02vm"
Stop-WAPackVM -VM $vm
Start-WAPackVM -VM $vm

# Provision new Azure Pack resources
(Get-WAPackVNet).Name
$vNet = Get-WAPackVNet `
-Name "kemlabdom01"
(Get-WAPackVMTemplate).Name
$vmTemplate = Get-WAPackVMTemplate `
-Name "DB Server"
$creds = Get-Credential
New-WAPackVM `
-Name "DB01" `
-Template $vmTemplate `
-VMCredential $Credentials `
-Windows `
-VNet $vNet

Learn more about Hybrid Cloud Automation …

Once you’ve completed this example for getting started with Hybrid Cloud automation, learn more with these additional resources: