How Do You Use PowerShell on Your Desktop to Manage Azure?

Problem scenario
You want to use PowerShell on your local machine to create, delete, and restart servers in Azure.  You want to do other things with Azure using PowerShell on your workstation.  What do you do?

1.  To run Azure commands from your desktop, you need to connect your PowerShell ISE with your Azure instance.  If you are using Windows 10, see this posting and ignore this set of directions here entitled "How Do You Use PowerShell on Your Desktop to Manage Azure?"  If you are using Windows 7, proceed to step #2 and remember that you will need to reboot your workstation.

2.  Install the Azure tools; you can download them here.

2.  When the installer above is open click "Add" next to "Microsoft Azure PowerShell."

3.  Click "Install."

4.  You can read the license terms.  It appears that the licenses are the Apache License and MIT License.  If you agree click "I accept."

5.  Reboot your computer.

6.  Open PowerShell.  Run this command: Get-AzurePublishSettingsFile

# Be prepared for a web browser to open up with the Azure Portal website.

7.  Log into the Azure Portal via the web browser as you normally would.

8.  You'll be prompted to open or save a file.  Save it wherever you like on your desktop.

9.  Draft a command like this:

Import-AzurePublishSettingsFile -PublishSettingsFile "C:\Users\jdoe\downloads\mysettings.publishsettings"

# where C:\users\jdoe\downloads\ is the path to the file you just downloaded.

Run this command once you've changed the location.

10.  Optional step. Run this command to verify it worked:

Get-ChildItem -Recurse cert:\ | Where-Object {$_.Issuer -like '*Azure*'} | select FriendlyName, Subject

# Above command was taken from this article.

11.  Now you can run Azure commands.  Optionally you can try this one: Get-AzureLocation

Leave a comment

Your email address will not be published. Required fields are marked *