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.
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.
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
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>
- 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:
- Make sure that
$HOME/.Azure
is present on the host (default location). - You may need to grant access this location for the docker process.
- Make sure that
$ 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
docker rmi mcr.microsoft.com/azurestack/powershell
- 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>]
- Run New-AzureStackTestResources.ps1 to create required resources for running the tests.
./New-AzureStackTestResources.ps1
[-Location <String>] # Defaults to $ENV:Location
- Run Test-AzsPowershell.ps1 to run the tests.
./Test-AzsPowershell.ps1
[-ClientObjectId <String>] # Defaults to $ENV:ClientObjectId
[-resourceLocation <String>] # Defaults to $ENV:Location
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.
AzureStack PowerShell is licensed under the Apache license.
PowerShell is licensed under the MIT license.
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.