Skip to content

Issue with special characters in SP credentials in latest version of Az CLI #13625

@AdamSharif-MSFT

Description

@AdamSharif-MSFT

Describe the bug

When created a new SP (or resetting credentials) n Azure CLI, special characters appear such as !, $, and ' which cause issues with variables/commands in Linux:

Example (obfuscated):

> az ad sp create-for-rbac
Creating a role assignment under the scope of "/subscriptions/**[redacted]**"
  Retrying role assignment creation: 1/36
{
  "appId": "dummy-app-id",
  "displayName": "**[redacted]**",
  "name": "**[redacted]**",
  "password": "**[redacted]**$9=:p;**[redacted]**(<5\\**[redacted]**@<a3r/N!**[redacted]**",
  "tenant": "**[redacted]**"
}

> pass="[redacted]" --> value from above
zsh: event not found: >I

To Reproduce

  1. az ad sp create-for-rbac --skip-assignment (or az ad sp credential reset)
  2. set variable as password value
  3. Try to use variable

Expected behavior

Secret value should contain only character which are permitted and usable in scripts/variables

Environment summary

> az version
{
  "azure-cli": "2.6.0",
  "azure-cli-command-modules-nspkg": "2.0.3",
  "azure-cli-core": "2.6.0",
  "azure-cli-nspkg": "3.0.4",
  "azure-cli-telemetry": "1.0.4",
  "extensions": {
    "aks-preview": "0.4.44",
    "azure-firewall": "0.3.1"
  }
}

WSL & Bash/Zsh, Ubuntu VM with Bash

Additional context

Testing a previous version of CLI such as 2.4, we see that secrets are generated as GUID format with only - for special characters. Same case for Azure PowerShell module.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions