About This Page
This page is part of the Azure documentation. It contains code examples and configuration instructions for working with Azure services.
Bias Analysis
Bias Types:
⚠️
powershell_heavy
⚠️
windows_first
⚠️
missing_linux_example
⚠️
windows_tools
Summary:
The documentation demonstrates a strong Windows bias throughout. All command-line examples are shown using Windows PowerShell, with Windows file paths and environment variable syntax. Windows-specific tools (certutil.exe, Notepad, Windows Explorer) are referenced exclusively, and instructions for editing system files (like the hosts file) are given only for Windows. There are no equivalent Linux or macOS instructions or examples, and the workflow assumes a Windows environment by default.
Recommendations:
- Provide parallel Linux (and optionally macOS) instructions and examples for all steps, including certificate conversion (using openssl), editing the hosts file (with sudo and a text editor like nano or vi), and setting environment variables (using export).
- Show Azure CLI and Python commands in a cross-platform way, avoiding Windows-only syntax and file paths.
- Reference cross-platform tools (e.g., openssl for certificate conversion, AzCopy for uploads) and avoid assuming the use of Windows Explorer or Notepad.
- Include sample outputs from Linux terminals (bash/zsh) in addition to PowerShell.
- Clearly indicate when a step is platform-specific and provide alternatives for each supported OS.
- Link to Azure CLI installation instructions for Linux and macOS, not just Windows.
Create pull request
Flagged Code Snippets
.\python.exe -m pip install haikunator
PS C:\Certificates> certutil.exe -encode aze-root.cer aze-root.pem
Input Length = 2150
Output Length = 3014
CertUtil: -encode command completed successfully.
PS C:\Certificates>
$pemFile = "<Path to the pem format certificate>"
PS C:\Certificates> az login -u EdgeARMuser
$ENV:AZURE_CLI_DISABLE_CONNECTION_VERIFICATION = 1
$ENV:ADAL_PYTHON_SSL_NO_VERIFY = 1
PS C:\windows\system32> az --version
azure-cli 2.0.80
command-modules-nspkg 2.0.3
core 2.0.80
nspkg 3.0.4
telemetry 1.0.4
Extensions:
azure-cli-iot-ext 0.7.1
Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\.azure\cliextensions'
Python (Windows) 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 02:47:15) [MSC v.1900 32 bit (Intel)]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.
Please let us know how we are doing: https://aka.ms/clihats
PS C:\windows\system32>
PS C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2> .\python.exe -m pip install haikunator
Collecting haikunator
Downloading https://files.pythonhosted.org/packages/43/fa/130968f1a1bb1461c287b9ff35c630460801783243acda2cbf3a4c5964a5/haikunator-2.1.0-py2.py3-none-any.whl
Installing collected packages: haikunator
Successfully installed haikunator-2.1.0
You are using pip version 10.0.1, however version 20.0.1 is available.
You should consider upgrading using the 'python -m pip install --upgrade pip' command.
PS C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2>
PS C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2> .\python.exe -m pip install msrestazure==0.6.2
Requirement already satisfied: msrestazure==0.6.2 in c:\program files (x86)\microsoft sdks\azure\cli2\lib\site-packages (0.6.2)
Requirement already satisfied: msrest<2.0.0,>=0.6.0 in c:\program files (x86)\microsoft sdks\azure\cli2\lib\site-packages (from msrestazure==0.6.2) (0.6.10)
=== CUT =========================== CUT ==================================
Requirement already satisfied: cffi!=1.11.3,>=1.8 in c:\program files (x86)\microsoft sdks\azure\cli2\lib\site-packages (from cryptography>=1.1.0->adal<2.0.0,>=0.6.0->msrestazure==0.6.2) (1.13.2)
Requirement already satisfied: pycparser in c:\program files (x86)\microsoft sdks\azure\cli2\lib\site-packages (from cffi!=1.11.3,>=1.8->cryptography>=1.1.0->adal<2.0.0,>=0.6.0->msrestazure==0.6.2) (2.18)
You are using pip version 10.0.1, however version 20.0.1 is available.
You should consider upgrading using the 'python -m pip install --upgrade pip' command.
PS C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2>
.\python -c "import certifi; print(certifi.where())"
PS C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2> .\python -c "import certifi; print(certifi.where())"
C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\certifi\cacert.pem
PS C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2>
$root = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
$root.Import($pemFile)
Write-Host "Extracting required information from the cert file"
$md5Hash = (Get-FileHash -Path $pemFile -Algorithm MD5).Hash.ToLower()
$sha1Hash = (Get-FileHash -Path $pemFile -Algorithm SHA1).Hash.ToLower()
$sha256Hash = (Get-FileHash -Path $pemFile -Algorithm SHA256).Hash.ToLower()
$issuerEntry = [string]::Format("# Issuer: {0}", $root.Issuer)
$subjectEntry = [string]::Format("# Subject: {0}", $root.Subject)
$labelEntry = [string]::Format("# Label: {0}", $root.Subject.Split('=')[-1])
$serialEntry = [string]::Format("# Serial: {0}", $root.GetSerialNumberString().ToLower())
$md5Entry = [string]::Format("# MD5 Fingerprint: {0}", $md5Hash)
$sha1Entry= [string]::Format("# SHA1 Fingerprint: {0}", $sha1Hash)
$sha256Entry = [string]::Format("# SHA256 Fingerprint: {0}", $sha256Hash)
$certText = (Get-Content -Path $pemFile -Raw).ToString().Replace("`r`n","`n")
$rootCertEntry = "`n" + $issuerEntry + "`n" + $subjectEntry + "`n" + $labelEntry + "`n" + `
$serialEntry + "`n" + $md5Entry + "`n" + $sha1Entry + "`n" + $sha256Entry + "`n" + $certText
Write-Host "Adding the certificate content to Python Cert store"
Add-Content "${env:ProgramFiles(x86)}\Microsoft SDKs\Azure\CLI2\Lib\site-packages\certifi\cacert.pem" $rootCertEntry
Write-Host "Python Cert store was updated to allow the Azure Stack Edge Pro CA root certificate"
$ENV:ARM_ENDPOINT = "https://management.team3device.teatraining1.com"
$ENV:AZURE_RESOURCE_LOCATION = "dbelocal"
$ENV:VHD_FILE_PATH = "C:\Downloads\Ubuntu1604\Ubuntu13.vhd"
$ENV:ADDRESS_PREFIXES = "5.5.0.0/16"
$ENV:PRIVATE_IP_ADDRESS = "5.5.174.126"
PS C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2> az cloud register -n az-new-env --endpoint-resource-manager "https://management.team3device.teatraining1.com"
PS C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2> az cloud set -n az-new-env
Switched active cloud to 'az-new-env'.
Use 'az login' to log in to this cloud.
Use 'az account set' to set the active subscription.
PS C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2>
PS C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2> az login -u EdgeARMuser
Password:
[
{
"cloudName": "az-new-env",
"id": "A4257FDE-B946-4E01-ADE7-674760B8D1A3",
"isDefault": true,
"name": "Default Provider Subscription",
"state": "Enabled",
"tenantId": "aaaabbbb-0000-cccc-1111-dddd2222eeee",
"user": {
"name": "EdgeArmUser@localhost",
"type": "user"
}
}
]
PS C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2>
$ENV:ARM_TENANT_ID = "aaaabbbb-0000-cccc-1111-dddd2222eeee"
$ENV:ARM_CLIENT_ID = "cbd868c5-7207-431f-8d16-1cb144b50971"
$ENV:ARM_CLIENT_SECRET - "<Your Azure Resource Manager password>"
$ENV:ARM_SUBSCRIPTION_ID = "<Your subscription ID>"
PS C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2> az cloud update --profile 2019-03-01-hybrid
PS C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2>
.\python.exe example_dbe_arguments_name_https.py cli
PS C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2> .\python.exe example_dbe_arguments_name_https.py cli
Create Resource Group
Create a storage account
Uploading to Azure Stack Storage as blob:
ubuntu13.vhd
Listing blobs...
ubuntu13.vhd
VM image resource id:
/subscriptions/.../resourceGroups/azure-sample-group-virtual-machines118/providers/Microsoft.Compute/images/UbuntuImage
Create Vnet
Create Subnet
Create NIC
Creating Linux Virtual Machine
Tag Virtual Machine
Create (empty) managed Data Disk
Get Virtual Machine by Name
Attach Data Disk
Detach Data Disk
Deallocating the VM (to prepare for a disk resize)
Update OS disk size
Start VM
Restart VM
Stop VM
List VMs in subscription
VM: VmName118
List VMs in resource group
VM: VmName118
Delete VM
All example operations completed successfully!
Delete Resource Group
Deleted: azure-sample-group-virtual-machines118
PS C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2>
certutil.exe <SourceCertificateName.cer> <DestinationCertificateName.pem>