Skip to content
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

[role] Confusing service error caused by invalid --scope argument: The api-version '2018-01-01-preview' is invalid. #7441

Closed
wy193777 opened this issue Sep 28, 2018 · 8 comments · Fixed by #13117
Assignees
Labels

Comments

@wy193777
Copy link

Describe the bug
az ad sp create-for-rbac use wrong apiVersion.

To Reproduce

az ad sp create-for-rbac --name autotools-master-sp --role contributor --scope /subscriptions/<subscript id>/myRG

Output:

Role assignment creation failed.

role assignment response headers: {'Cache-Control': 'no-cache', 'Pragma': 'no-cache', 'Content-Type': 'application/json; charset=utf-8', 'Expires': '-1', 'x-ms-failure-cause': 'gateway', 'x-ms-request-id': '297b982c-922a-4940-91b4-fcd6478c87f3', 'x-ms-correlation-request-id': '297b982c-922a-4940-91b4-fcd6478c87f3', 'x-ms-routing-request-id': 'WESTUS:20180928T211950Z:297b982c-922a-4940-91b4-fcd6478c87f3', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains', 'X-Content-Type-Options': 'nosniff', 'Date': 'Fri, 28 Sep 2018 21:19:49 GMT', 'Content-Length': '407'}

The api-version '2018-01-01-preview' is invalid. The supported versions are '2018-08-01,2018-07-01,2018-06-01,2018-05-01,2018-02-01,2018-01-01,2017-12-01,2017-08-01,2017-06-01,2017-05-10,2017-05-01,2017-03-01,2016-09-01,2016-07-01,2016-06-01,2016-02-01,2015-11-01,2015-01-01,2014-04-01-preview,2014-04-01,2014-01-01,2013-03-01,2014-02-26,2014-04'.

Expected behavior
The service principal been created an role been assigned properly.

Environment summary
Azure Cloud Shell Bash

$ az --version
azure-cli (2.0.46)

acr (2.1.5)
acs (2.3.4)
advisor (0.6.0)
ams (0.2.3)
appservice (0.2.4)
backup (1.2.1)
batch (3.4.0)
batchai (0.4.3)
billing (0.2.0)
botservice (0.1.1)
cdn (0.1.1)
cloud (2.1.0)
cognitiveservices (0.2.3)
command-modules-nspkg (2.0.2)
configure (2.0.18)
consumption (0.4.0)
container (0.3.4)
core (2.0.46)
cosmosdb (0.2.1)
dla (0.2.3)
dls (0.1.3)
dms (0.1.1)
eventgrid (0.2.0)
eventhubs (0.2.4)
extension (0.2.1)
feedback (2.1.4)
find (0.2.12)
interactive (0.3.30)
iot (0.3.2)
iotcentral (0.1.2)
keyvault (2.2.3)
lab (0.1.1)
maps (0.3.2)
monitor (0.2.3)
network (2.2.5)
nspkg (3.0.3)
policyinsights (0.1.0)
profile (2.1.1)
rdbms (0.3.2)
redis (0.3.2)
relay (0.1.2)
reservations (0.4.0)
resource (2.1.4)
role (2.1.5)
search (0.1.1)
servicebus (0.2.3)
servicefabric (0.1.3)
signalr (1.0.0)
sql (2.1.4)
storage (2.2.2)
telemetry (1.0.0)
vm (2.2.3)

Python location '/opt/az/bin/python3'
Extensions directory '/home/myname/.azure/cliextensions'

Python (Linux) 3.6.5 (default, Sep 18 2018, 21:58:22)
[GCC 5.4.0 20160609]

Legal docs and information: aka.ms/AzureCliLegal

**Additional context**
Add any other context about the problem here.
@yugangw-msft
Copy link
Contributor

yugangw-msft commented Sep 28, 2018

Are you in azure stack, aka private cloud?

@yugangw-msft yugangw-msft added the RBAC az role label Sep 28, 2018
@wy193777
Copy link
Author

@yugangw-msft I don't think so. How can I verify this?

@yugangw-msft
Copy link
Contributor

yugangw-msft commented Sep 29, 2018

Run az account show --query "environmentName" and make sure the output is AzureCloud
If yes, please run az assignment list and let me know whether or not it fails for the same error

@wy193777
Copy link
Author

It's AzureCloud.

az assignment list return error az: 'assignment' is not in the 'az' command group. See 'az --help'..

I guess you want me to run az role assignment list. All roles have been printed without any error after running this command.

@yugangw-msft
Copy link
Contributor

correct, i meant az role assignment list
to isolate, can you just run az ad sp create-for-rbac w/o any argument? does that work?

@yugangw-msft
Copy link
Contributor

i believe your scope might be wrong /subscriptions/<subscript id>/myRG, you missed a resourceGroups in the middle. Should be /subscriptions/<subscript id>/resourceGroups/myRG

@wy193777
Copy link
Author

wy193777 commented Sep 29, 2018

@yugangw-msft you are right, I missed a resourceGroups in the middle. After added it, I created the service principal successfully.

Maybe you can change this ticket to something like misleading error when a wrong scope been specified.

@yugangw-msft yugangw-msft changed the title az ad sp create-for-rbac use wrong apiVersion [role]: confusing service error caused by invalid --scope argument Oct 1, 2018
@yugangw-msft yugangw-msft added Account az login/account and removed RBAC az role labels Oct 1, 2018
@yugangw-msft yugangw-msft added Authorization and removed Account az login/account labels Oct 18, 2018
@mozehgir mozehgir added RBAC az role and removed Authorization labels Jul 26, 2019
@yonzhan yonzhan added this to the S164 milestone Dec 9, 2019
@yonzhan
Copy link
Collaborator

yonzhan commented Dec 9, 2019

add to S164.

@yonzhan yonzhan added the RBAC az role label Dec 26, 2019
@yonzhan yonzhan assigned arrownj and unassigned jiasli Jan 30, 2020
@yonzhan yonzhan modified the milestones: S164, S165 Jan 30, 2020
@arrownj arrownj modified the milestones: S165, S166 Feb 17, 2020
@yungezz yungezz modified the milestones: S166, S167 Mar 11, 2020
@yungezz yungezz modified the milestones: S167, S169 Mar 31, 2020
@jiasli jiasli changed the title [role]: confusing service error caused by invalid --scope argument [role] Confusing service error caused by invalid --scope argument: The api-version '2018-01-01-preview' is invalid. Dec 19, 2022
@jiasli jiasli assigned jiasli and unassigned arrownj Dec 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants