I wrote these articles about the Azure CLI but that was at version 0.10.8 and things have progressed since then. #Azure #AzureGermanCloud #GermanCloud #CLI
- Using Azure Xplat-CLI with Azure App Services in the German Cloud
- Azure CLI ‘config’ is not an azure command
- CLI articles by Benjamin
Here is some good CLI 2.0 information.
It is becoming very apparent, well, it has been this way for some time now that although I work at Microsoft I find myself using many, many open source technologies like never before. This is one of those cases, here are a few others I have documented:
- How I tested debugged my chatbot that I created using the Bot Services on Azure
- update as I write them
This article specifically explains how I installed Azure CLI 2.0 and then logged into my Azure subscriptions, both in the Azure public cloud and the Azure German Cloud. Here is how I did it:
- Download and install Python
- Install Azure CLI 2.0 with bash
- Execute the ‘az’ commands set the environment and login
Download and install Python
I downloaded the 32bit version of Python from here, 3.6.1 was the most recent version at the time. See Figure 1.
Figure 1, download python for Azure CLI 2.0 activity
I downloaded the EXE installation package and installed it as seen in Figure 2.
Figure 2, install python for Azure CLI 2.0 activity
Install Azure CLI 2.0 with bash
As per the instructions here, I executed the following python / pip commands:
pip install –user azure-cli
The output may be something similar as shown in Figure 3.
Figure 3, install Azure CLI 2.0 using python and pip
Execute the ‘az’ commands set the environment and login
You need to navigate to the location of the az.bat file or set that path in your environment settings. Regardless the path is:
%USERPROFILE%\AppData\Roaming\Python\PythonXY\Scripts where XY is your Python version
Once you have done either of the above, execute the az. bat and you may see something similar to that shown in Figure 4.
Figure 4, execute Azure CLI 2.0 using az.bat or simply az
If this is the first time you are running this or perhaps at some time in the future, you want to most often be on the most current version of the toolset. Execute the following command as shown also in Figure 5.
az component update
Figure 5, how to update Azure CLI to the most current version
By default, the Azure Environment you would attempt to access is AzureCloud which is the public cloud. If you need to access the Azure German Cloud then you need to set the environment name to AzureGermanCloud by using this command also shown in Figure 6.
az cloud set –name AzureGermanCloud
Figure 6, how to login to the Azure German Cloud using Azure CLI 2.0
Then execute the following command, also shown in Figure 6 to login.
This will provide render a URL that you need to put into a browser and enter the associated code. Once authenticated, you can execute other az commands. Notice the small difference in the URL for the public cloud versus the German Cloud.
C:\Users\UID>az context list
C:\Users\UID>az context modify --cloud AzureGermanCloud
C:\Users\UID>az context list
C:\Users\UID>az login -u <MyAccount> -p <MyPassword>
"name": "Germany - Internal Consumption",