Skip to content
2 changes: 2 additions & 0 deletions src/azure-cli/azure/cli/command_modules/role/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@
helps['ad sp create'] = """
type: command
short-summary: Create a service principal.
long-summary: When you create a service principal using the `az ad sp create` command, the output includes credentials that you must protect. Be sure that you do not include these credentials in your code or check the credentials into your source control. As an alternative, consider using `managed identities` (https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/overview) to avoid the need to use credentials.

@jiasli jiasli Nov 10, 2020

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ad sp create simply creates a Service Principal from an app and won't show any credentials.

> az ad app create --display-name myapp20201110
  ...
  "appId": "d990dd3e-f5fe-4d3c-bb62-3e568a5b1209",

> az ad sp create --id d990dd3e-f5fe-4d3c-bb62-3e568a5b1209
  ...
  "appId": "d990dd3e-f5fe-4d3c-bb62-3e568a5b1209",

This help message should go to az ad app/sp credential reset instead.

> az ad app credential reset --id d990dd3e-f5fe-4d3c-bb62-3e568a5b1209
{
  "appId": "d990dd3e-f5fe-4d3c-bb62-3e568a5b1209",
  "name": "d990dd3e-f5fe-4d3c-bb62-3e568a5b1209",
  "password": "3f~XjdIB0AML4...",
  "tenant": "54826b22-38d6-4fb2-bad9-b7b93a3e9c5a"
}

examples:
- name: Create a service principal. (autogenerated)
text: az ad sp create --id 00000000-0000-0000-0000-000000000000
Expand All @@ -370,6 +371,7 @@
helps['ad sp create-for-rbac'] = """
type: command
short-summary: Create a service principal and configure its access to Azure resources.
long-summary: When you create a service principal using the `az ad sp create-for-rbac` command, the output includes credentials that you must protect. Be sure that you do not include these credentials in your code or check the credentials into your source control. As an alternative, consider using `managed identities` (https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/overview) to avoid the need to use credentials. By default, `az ad sp create-for-rbac` assigns the `Contributor` role to the service principal at the subscription scope. To reduce your risk of a compromised service principal, assign a more specific role and narrow the scope to a resource or resource group. See https://docs.microsoft.com/en-us/azure/role-based-access-control/role-assignments-steps for more information.
Comment thread
dbradish-microsoft marked this conversation as resolved.
Outdated
parameters:
- name: --name -n
short-summary: A URI to use as the logic name. It doesn't need to exist. If not present, CLI will generate one.
Expand Down