Azure / Azure/azure-cli

Passwords from az ad app credential reset starting with character (-) are not accepted by az keyvault secret set

Open
#23,016 2 comments 0 reactions 2 assignees Claimed by @jiasli View on GitHub
act-identity-squad Auto-Assign customer-reported Graph KeyVault
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

`az ad app create --password` [has been depreciated](https://docs.microsoft.com/en-us/cli/azure/microsoft-graph-migration) because of Graph migration.
_"Remove --password... Use `az ad app credential reset` to let Graph service create a password for you (https://github.com/Azure/azure-cli/issues/20675)"_

**Related command**
`az ad app credential reset`
`az keyvault secret set`

**Describe the bug**
Using `az ad app credential reset` generates (sometimes) passwords that start with the character (-), causing `az keyvault secret set --name test_test --value ` to fail (also when quoted!). (now it's hoping the passwords generated, don't start with the wrong character, breaking the script.)

**To Reproduce**
Make a small script creating an `app az ad app create` and set the `az ad app credential reset` if the credentials starts with (-) try to run `az keyvault secret set` -value

```
me@Macbook-Air ~ % az keyvault secret set --name app-mon-password --value adadasfasd --vault-name setupcheck-tst
{
"attributes": {
"created": "2022-06-24T16:11:30+00:00",
"enabled": true,
"expires": null,
"notBefore": null,
"recoveryLevel": "Recoverable+Purgeable",
"updated": "2022-06-24T16:11:30+00:00"
},
"contentType": null,
"id": "https://setupcheck-tst.vault.azure.net/secrets/app-mon-password/9f3f0cfdb5a0444fa080aec691ef4fab",
"kid": null,
"managed": null,
"name": "app-mon-password",
"tags": {
"file-encoding": "utf-8"
},
"value": "adadasfasd"
}
me@Macbook-Air ~ % az keyvault secret set --name app-mon-password --value "-adadasfasd" --vault-name setupcheck-tst
argument --value: expected one argument
```

**Expected behaviour**
Passwords that don't break other commands or commands that accept them. Perhaps best to remove the - as a character that `az ad app credential reset` uses in passwords!

**Environment summary**
A .devcontainer with Python 3.9 and Azure-cli 2.37.0

**Screenshot**
![Screenshot 2022-06-24 at 17 32 05](https://user-images.githubusercontent.com/24792888/175568518-8612717f-55e8-4db8-9754-e7f63b3a3f07.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.