Skip to content

Commit

Permalink
Fix broken az devops auth (#1226)
Browse files Browse the repository at this point in the history
* Service.py runstyle changes

* Removed unused variables

* Added White space

* minCliCoreVersion changed

Co-authored-by: Roshan Soni <[email protected]>
  • Loading branch information
roshan-sy and Roshan Soni committed Nov 8, 2021
1 parent 3c90fbf commit 752849b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion azure-devops/azext_devops/azext_metadata.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"azext.minCliCoreVersion": "2.2.0"
"azext.minCliCoreVersion": "2.30.0"
}
9 changes: 6 additions & 3 deletions azure-devops/azext_devops/dev/common/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def get_token_from_az_logins(organization, pat_token_present):
for key, dummy_value in tenantsDict.items():
try:
logger.debug('trying to get token (temp) for tenant %s and user %s ', key[0], key[1])
token = get_token_from_az_login(profile, key[1], key[0])
token = get_token_from_az_login(profile, key[0])
credentials = BasicAuthentication('', token)

if skipValidateToken is True:
Expand All @@ -152,9 +152,12 @@ def get_token_from_az_logins(organization, pat_token_present):
return ''


def get_token_from_az_login(profile, user, tenant):
def get_token_from_az_login(profile, tenant):
try:
auth_token = profile.get_access_token_for_resource(user, tenant, '499b84ac-1321-427f-aa17-267ca6975798')
raw = profile.get_raw_token(
resource='499b84ac-1321-427f-aa17-267ca6975798', tenant=tenant)
creds = raw[0]
auth_token = creds[1]
return auth_token
except BaseException as ex: # pylint: disable=broad-except
logger.debug('not able to get token from az login')
Expand Down

0 comments on commit 752849b

Please sign in to comment.