azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

"az ad sp create-for-rbac" should set sensible defaults

Open anhowe opened this issue 10 years ago • 4 comments

"az ad sp create-for-rbac" does not set sensible defaults and the resulting principal is not very usable. It would be great if it would setup defaults as the following "az ad sp create-for-rbac --role contributor --scopes /subscriptions/SUBSCRIPTIONID".

anhowe avatar Oct 31 '16 18:10 anhowe

@anhowe, you can use az role assignment create to create new ones at any time. The help of az ad sp create-for-rbac calls out the format: az ad sp create-for-rbac -n "http://my-app" --role contributor --scopes ...

Does that help? Or you feel it unlikely you will create any other assignments in future so you like to get all done at one shot?

yugangw-msft avatar Oct 31 '16 19:10 yugangw-msft

Two people hit this so far. Two possible solutions:

  1. by default for command "az ad sp create-for-rbac", assign "--role contributor --scopes /subscriptions/SUBSCRIPTIONID"
  2. give an error if the customer does not set role or scopes (and override with --force if they really want no roles or scopes)

anhowe avatar Nov 02 '16 21:11 anhowe

+1 I'm not sure how much value there is in an SP with no roles or scopes. Since providing sensible defaults seems to be a goal for the CLI (e.g. vm create), it seems like it would make sense to add some prescription to the az ad sp create-for-rbac command in order to simplify it.

lostintangent avatar Nov 03 '16 17:11 lostintangent

Thanks for the data. I will do the change

yugangw-msft avatar Nov 03 '16 17:11 yugangw-msft