Training
Certification
Microsoft Certified: Azure Virtual Desktop Specialty - Certifications
Plan, deliver, manage, and monitor virtual desktop experiences and remote apps on Microsoft Azure for any device.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
In this article, you learn how you can leverage Azure Automation to provision a virtual machine in your Amazon Web Service (AWS) subscription and give that VM a specific name - which AWS refers to as “tagging” the VM.
You need to have an Azure Automation account and an Amazon Web Services (AWS) subscription. For more information on setting up an Azure Automation account and configuring it with your AWS subscription credentials, review Configure Authentication with Amazon Web Services. This account should be created or updated with your AWS subscription credentials before proceeding, as you reference this account in the sections below.
Your VM provisioning runbook uses the AWS PowerShell module to do its work. Use the following steps to add the module to your Automation account that is configured with your AWS subscription credentials.
Open your web browser and navigate to the PowerShell Gallery and click on the Deploy to Azure Automation button.
You are taken to the Azure login page and after authenticating, you will be routed to the Azure portal and presented with the following page:
Select the Automation account to use and click OK to start deployment.
Note
When Azure Automation imports a PowerShell module, it extracts the cmdlets. The activities don't appear until Automation has completely finished importing the module and extracting the cmdlets. This process can take a few minutes.
In the Azure portal, open your Automation account.
Click on the Assets tile and, on the Assets pane, select Modules.
On the Modules page, you see the AWSPowerShell module in the list.
Once the AWS PowerShell Module has been deployed, you can now author a runbook to automate provisioning a virtual machine in AWS using a PowerShell script. The steps below demonstrate how to use native PowerShell script in Azure Automation.
Note
For further options and information regarding this script, please visit the PowerShell Gallery.
Download the PowerShell script New-AwsVM from the PowerShell Gallery by opening a PowerShell session and typing the following command:
Save-Script -Name New-AwsVM -Path <path>
From the Azure portal, open your Automation account and select Runbooks under Process Automation.
From the Runbooks page, select Add a runbook.
On the Add a runbook pane, select Quick Create to create a new runbook.
On the Runbook properties pane, type in a name for your runbook.
From the Runbook type drop-down list, select PowerShell, and then click Create.
When the Edit PowerShell Runbook page appears, copy and paste the PowerShell script into the runbook authoring canvas.
Note the following when working with the example PowerShell script:
AWScred
, you need to update the script on line 57 to match accordingly.To retrieve a list of image names from your AWS subscription, launch PowerShell ISE and import the AWS PowerShell Module. Authenticate against AWS by replacing Get-AutomationPSCredential
in your ISE environment with AWScred = Get-Credential
. This statement prompts for your credentials and you can provide your access key ID for the user name and your secret access key for the password.
#Sample to get the AWS VM available images
#Please provide the path where you have downloaded the AWS PowerShell module
Import-Module AWSPowerShell
$AwsRegion = "us-west-2"
$AwsCred = Get-Credential
$AwsAccessKeyId = $AwsCred.UserName
$AwsSecretKey = $AwsCred.GetNetworkCredential().Password
# Set up the environment to access AWS
Set-AwsCredentials -AccessKey $AwsAccessKeyId -SecretKey $AwsSecretKey -StoreAs AWSProfile
Set-DefaultAWSRegion -Region $AwsRegion
Get-EC2ImageByName -ProfileName AWSProfile
The following output is returned:
Copy and paste the one of the image names in an Automation variable as referenced in the runbook as $InstanceType
. Since, in this example, you are using the free AWS tiered subscription, you use t2.micro for your runbook example.
Save the runbook, then click Publish to publish the runbook and then Yes when prompted.
AWScred
for authenticating against AWS, or update the script to reference your credential asset name.Training
Certification
Microsoft Certified: Azure Virtual Desktop Specialty - Certifications
Plan, deliver, manage, and monitor virtual desktop experiences and remote apps on Microsoft Azure for any device.
Documentation
This article tells what Azure Automation is and how to use it to automate the lifecycle of infrastructure and applications.