Skip to content

Latest commit

 

History

History

docker

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Docker

Overview

These Dockerfiles enable executing AzureStack PowerShell cmdlets in a container for the supported OS.
The container images also include support for AzureStack release 2002+ by including AzureStack Admin Modules and AzureStack Tools.

Configuration

This image requires Docker 17.05 or newer.

It is also expected that you are able to run Docker without sudo. Please follow Docker's official instructions to install docker correctly.

Release

The release containers derive from the Powershell image, and then install the current Az package. Starting with Az 3.6.1 the images are using PowerShell 7, the previous versions are using PowerShell 6.2.4.

AzureStack PowerShell release notes

Examples

Download/Update the AzureStack Powershell image

You may replace the tag part after the colon with the tag of the image OS you want, e.g., 0.1.0-ubuntu-18.04.

docker pull mcr.microsoft.com/azurestack/powershell:<tag>

Run AzureStack Powershell container

  • To run AzureStack Powershell in a container in an interactive mode:
$ docker run -it mcr.microsoft.com/azurestack/powershell:0.1.0-ubuntu-18.04 pwsh 
  • To run AzureStack Powershell in a container:
$ docker start -ia mcr.microsoft.com/azurestack/powershell:0.1.0-ubuntu-18.04 pwsh 
  • To run AzureStack Powershell from using a container in an interactive mode using host authentication:

    1. Make sure that $HOME/.Azure is present on the host (default location).
    2. You may need to grant access this location for the docker process.
$ docker run -it -v ~/.Azure/AzureRmContext.json:/root/.Azure/AzureRmContext.json -v ~/.Azure/TokenCache.dat:/root/.Azure/TokenCache.dat mcr.microsoft.com/azurestack/powershell pwsh 

Verify the host authentication:

docker run -it --rm -v ~/.Azure/AzureRmContext.json:/root/.Azure/AzureRmContext.json -v ~/.Azure/TokenCache.dat:/root/.Azure/TokenCache.dat mcr.microsoft.com/azurestack/powershell pwsh -c Get-AzContext

Remove image

docker rmi mcr.microsoft.com/azurestack/powershell

Testing

  1. Run Login-Environment.ps1 to create an environment and connect your AzureStack account to it.

Note: The default value for parameters are set in the environment variables of the containers using a docker command when first running the container such as in the following docker command:

docker run 
-e "Location=<LOCATION>" 
-e "ClientObjectId=<CLIENT_OBJECT_ID>" 
-it <IMAGE_URL>:<IMAGE_TAG>

Login using credentials:

./Login-Environment.ps1 
[-Name <String>]  # Defaults to 'AzureStack'
-ResourceManagerEndpoint <System.Uri>  
-DirectoryTenantId <String>  
-Credential <PSCredential>  
[-SubscriptionId <String>]

Login using certificates:

./Login-Environment.ps1  
[-Name <String>]  # Defaults to 'AzureStack'
-ResourceManagerEndpoint <System.Uri>  
-DirectoryTenantId <String>  
-ApplicationId <String>  
-CertificateThumbprint <String>  
[-SubscriptionId <String>]
  1. Run New-AzureStackTestResources.ps1 to create required resources for running the tests.
./New-AzureStackTestResources.ps1  
[-Location <String>]  # Defaults to $ENV:Location
  1. Run Test-AzsPowershell.ps1 to run the tests.
./Test-AzsPowershell.ps1  
[-ClientObjectId <String>]  # Defaults to $ENV:ClientObjectId
[-resourceLocation <String>]  # Defaults to $ENV:Location

Developing and Contributing

Please see the Contribution Guide for general information about how to develop and contribute.

If you have any problems, please consult the GitHub issues. If you do not see your problem captured, please file a new issue and follow the provided template.

Legal and Licensing

AzureStack PowerShell is licensed under the Apache license.

PowerShell is licensed under the MIT license.

[Code of Conduct][conduct-md]

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.