{Microsoft Entra ID} az ad sp create-for-rbac: Update examples and warnings#30277
{Microsoft Entra ID} az ad sp create-for-rbac: Update examples and warnings#30277
az ad sp create-for-rbac: Update examples and warnings#30277Conversation
️✔️AzureCLI-FullTest
|
|
Hi @jiasli, |
️✔️AzureCLI-BreakingChangeTest
|
|
Update examples and warnings |
| - name: Create using an existing certificate string. | ||
| text: az ad sp create-for-rbac --cert "MIICoT..." | ||
| - name: Create using an existing certificate file. | ||
| text: |- | ||
| az ad sp create-for-rbac --cert "@~/cert.pem" | ||
| `cert.pem` contains the following content | ||
| -----BEGIN CERTIFICATE----- <<< this line is optional | ||
| MIICoT... | ||
| -----END CERTIFICATE----- <<< this line is optional |
There was a problem hiding this comment.
These examples are similar to
azure-cli/src/azure-cli/azure/cli/command_modules/role/_help.py
Lines 127 to 135 in 031de0d
azure-cli/src/azure-cli/azure/cli/command_modules/role/_help.py
Lines 594 to 602 in 031de0d
| - name: Create using a self-signed certificate, and store it within Azure Key Vault. | ||
| text: az ad sp create-for-rbac --keyvault MyVault --cert CertName --create-cert | ||
| - name: Create using existing certificate in Azure Key Vault. | ||
| text: az ad sp create-for-rbac --keyvault MyVault --cert CertName |
There was a problem hiding this comment.
The official name should be "Azure Key Vault", not "KeyVault": https://learn.microsoft.com/en-us/azure/key-vault/secrets/quick-create-cli
| if cert_file: | ||
| logger.warning( | ||
| "Please copy %s to a safe place. When you run 'az login', provide the file path in the --password argument", | ||
| "Please copy %s to a safe place. When you run `az login`, provide the file path in the --certificate " |
|
|
||
| login_hint = ('To log in with this service principal, run:\n' | ||
| f'az login --service-principal --username {app_id} --password {password or cert_file} ' | ||
| f'--tenant {graph_client.tenant}') | ||
| logger.info(login_hint) |
There was a problem hiding this comment.
This hint is removed to avoid users' potential incorrect handling of the log.
az ad sp create-for-rbac: Add examples for using --certaz ad sp create-for-rbac: Update examples and warnings
| text: az ad sp create-for-rbac --keyvault MyVault --cert CertName --create-cert | ||
| - name: Create using existing certificate in KeyVault. | ||
| text: az ad sp create-for-rbac --keyvault MyVault --cert CertName | ||
| - name: Create without role assignment. |
There was a problem hiding this comment.
Although it does not affect the help message, the two-space indent is missing here.
There was a problem hiding this comment.
On the contrary, the two-space indent is unnecessary. See the YAML spec:
https://yaml.org/spec/1.2.2/#21-collections
american:
- Boston Red Sox
- Detroit Tigers
- New York Yankees
national:
- New York Mets
- Chicago Cubs
- Atlanta BravesThere was a problem hiding this comment.
YAML does not have a strict indent rule; my formatter uses 2 spaces.
In YAML block styles, structure is determined by indentation. In general, indentation is defined as a zero or more space characters at the start of a line. -- https://yaml.org/spec/1.2-old/spec.html#id2777534
PS: The indentation at https://yaml.org/ is inconsistent.


Related command
az ad sp create-for-rbacDescription
--certto clarify Article for service creation principal has misleading guidance for --cert MicrosoftDocs/azure-docs-cli#4734--create-certaccording to [Profile]az login: Add--certificatefor authenticating with service principal certificate #30091Testing Guide
az ad sp create-for-rbac -h