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
⚠️
windows_tools
⚠️
missing_linux_example
Summary:
The documentation is heavily oriented towards Windows and PowerShell usage. All command-line examples for managing credentials use PowerShell cmdlets, with no mention of Bash, CLI, or Linux-native tools. The workflow and terminology (e.g., PSCredential, cmdlet) are Windows-centric. The only non-Windows examples are for Python runbooks, but there are no Linux shell or cross-platform CLI examples for credential management. The documentation refers to 'Windows PowerShell' explicitly and does not address Linux automation scenarios or tools.
Recommendations:
- Add Azure CLI examples for credential asset management, including creation, retrieval, and deletion, to provide parity for Linux and cross-platform users.
- Include Bash shell script examples where applicable, especially for retrieving credentials in runbooks or automation tasks.
- Clarify whether credential management is possible from non-Windows environments and, if so, document the process.
- Avoid using 'Windows PowerShell' as the default terminology; instead, use 'PowerShell' or specify when examples are cross-platform.
- Mention any limitations or differences in credential management when using Linux Hybrid Runbook Workers or cross-platform agents.
- Provide links or references to Linux or cross-platform documentation where available.
Create pull request
Flagged Code Snippets
Import-Module Orchestrator.AssetManagement.Cmdlets -ErrorAction SilentlyContinue
$user = "MyDomain\MyUser"
$pw = ConvertTo-SecureString "PassWord!" -AsPlainText -Force
$cred = New-Object –TypeName System.Management.Automation.PSCredential –ArgumentList $user, $pw
New-AzureAutomationCredential -AutomationAccountName "MyAutomationAccount" -Name "MyCredential" -Value $cred
$myCredential = Get-AutomationPSCredential -Name 'MyCredential'
$userName = $myCredential.UserName
$securePassword = $myCredential.Password
$password = $myCredential.GetNetworkCredential().Password
# Ensures you do not inherit an AzContext in your runbook
Disable-AzContextAutosave -Scope Process
# Connect to Azure with system-assigned managed identity
$AzureContext = (Connect-AzAccount -Identity).context
# set and store context
$AzureContext = Set-AzContext -SubscriptionName $AzureContext.Subscription -DefaultProfile $AzureContext
# Get credential
$myCred = Get-AutomationPSCredential -Name "MyCredential"
$userName = $myCred.UserName
$securePassword = $myCred.Password
$password = $myCred.GetNetworkCredential().Password
$myPsCred = New-Object System.Management.Automation.PSCredential ($userName,$securePassword)
# Connect to Azure with credential
$AzureContext = (Connect-AzAccount -Credential $myPsCred -TenantId $AzureContext.Subscription.TenantId).context
# set and store context
$AzureContext = Set-AzContext -SubscriptionName $AzureContext.Subscription `
-TenantId $AzureContext.Subscription.TenantId `
-DefaultProfile $AzureContext