Skip to content

{REST} Only extract subscription ID for ARM requests - #13782

Merged
jiasli merged 3 commits into
Azure:devfrom
jiasli:rest
Jun 8, 2020
Merged

{REST} Only extract subscription ID for ARM requests#13782
jiasli merged 3 commits into
Azure:devfrom
jiasli:rest

Conversation

@jiasli

@jiasli jiasli commented Jun 2, 2020

Copy link
Copy Markdown
Contributor

Description
Fix regression introduced in #13225.

az rest now only extracts subscription ID for ARM requests, not for AD Graph request.

The ID (00000002-0000-0000-0000-000000000000) in an AD Graph request (https://graph.windows.net/00000002-0000-0000-0000-000000000000/applications/00000003-0000-0000-0000-000000000000?api-version=1.6) is tenant ID. Using it as a subscription ID will cause failure in get_raw_token.

Testing Guide

> az rest -u https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups?api-version=2019-07-01 --debug 1>$null
...
Retrieving token for resource https://management.core.windows.net/, subscription 0b1f6471-1bf0-4dda-aec3-cb9272f09590

@jiasli jiasli changed the title Only extract subscription ID for ARM requests [REST] Only extract subscription ID for ARM requests Jun 2, 2020
@yonzhan yonzhan added this to the S171 milestone Jun 2, 2020
@yonzhan

yonzhan commented Jun 2, 2020

Copy link
Copy Markdown
Collaborator

add to S171

@mmyyrroonn mmyyrroonn left a comment

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.

LGTM

# https://management.azure.com/ + subscriptions/xxx/resourcegroups/xxx?api-version=2019-07-01
if '://' not in url:
url = cli_ctx.cloud.endpoints.resource_manager + url.lstrip('/')
url = endpoints.resource_manager.rstrip('/') + url

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.

is this change necessary?

@jiasli jiasli Jun 5, 2020

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No. Only for consistency and keep the resource ID intact.

@jiasli

jiasli commented Jun 5, 2020

Copy link
Copy Markdown
Contributor Author

Add @myronfanqiu as code owner for core as he is actively working on send_raw_request.

@jiasli jiasli changed the title [REST] Only extract subscription ID for ARM requests {REST} Only extract subscription ID for ARM requests Jun 8, 2020
@jiasli
jiasli merged commit 6f61ad3 into Azure:dev Jun 8, 2020
@jiasli
jiasli deleted the rest branch June 8, 2020 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants