Azure PowerShell Docker image

This post has been republished via RSS; it originally appeared at: New blog articles in Microsoft Tech Community.

With Azure constantly evolving and a new version of the Azure PowerShell modules every three weeks, it becomes quickly very challenging to maintain a production or development environment up to date and ensuring the smooth execution of scripts.

In order to facilitate this mission, we are excited to announce the first availability of the Azure PowerShell Docker image.

 

Azure PowerShell on docker hubAzure PowerShell on docker hub

Scenarios

The Azure PowerShell docker image provides a contained environment with PowerShell and the Az module pre-installed:

  • On the same machine you can run scripts that are using different version of Az with no conflicts.
  • You can test a script against a different version of Az with no risks.
  • You can run interactively the latest image with the following command:

You can run interactively the latest image with the following command:

 

docker run -it mcr.microsoft.com/azure-powershell

 

Running PowerShell interactively in docker containerRunning PowerShell interactively in docker container

 

It is possible to run a script targeting a specific version of Az:

docker run -it -v C:\Users\dcaro\src:/src mcr.microsoft.com/azure-powershell:3.6.1-ubuntu-18.04 pwsh -file /src/script.ps1

The following screenshot shows the same script being executed against two versions of Az.

 

runscripts-different-images.png

 

Note: For windows-based systems, you must share with the docker daemon the location on the host where the script is located. More information here: https://docs.docker.com/docker-for-windows/#file-sharing

Supported versions

The latest container image contains the latest version of PowerShell and the latest Azure PowerShell modules supported with the Az module.

For each new release of the Az module we are releasing an image for the following operating systems:

  • Ubuntu 18.04 (default)
  • Debian 9
  • CentOs 7

Roadmap

While we are excited about this initial release, we want to share some plans, including but not limited to:

  • Add modules in preview
  • Add support for Windows based containers

Please share your feedback and let us know what you’d like to see added to the list!

 

The Azure PowerShell team

 

Leave a Reply

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

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.