-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[Role] Add long-summary/warning for commands generating credentials #15825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@jiasli , We've been asked by Robert Lyon [email protected], to add the following warnings to our reference content: Warning for az ad sp create Warning for az ad sp create-for-rbac 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. Could you please verify that I have entered this in the correct location and format? The create-for-rbac message also needs a line break (two separate paragraphs) if possible. Thank you. |
|
add to S178 |
|
For my perspective, it may not be enough to add these warnings to help only. Customers won't see this if they don't use |
| 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. |
There was a problem hiding this comment.
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"
}
|
Please make sure that the PR title complies with our convention so that the CI can pass. |
Good point. However, post-output hint is used to parse the output JSON and give the user more friendly information. This warning doesn't rely on the output of In addition, the output of this command is not too long. A pre-output hint should suffice. Something like |
Co-authored-by: Jiashuo Li <[email protected]>
evelyn-ys
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
Description
az ad sp create-for-rbacaz ad sp credential resetaz ad app credential resetThese commands may
The user may accidentally check the credentials into the source control.
This PRs explicitly tells the user about the behavior via
help
warning
Testing Guide
ℹ Whether
az ad sp create-for-rbacshould assign Contributor role by default is still under debate. (#16081)