Skip to content

Conversation

@jiasli
Copy link
Member

@jiasli jiasli commented Apr 8, 2021

Dependencies

CAE b3 support build upon

This PR is a rework of #17070.

Testing Guide

# Log in with CAE enabled
> az login

# A successful command using Track 2 SDK
> az storage account list

# A successful command using Track 1 SDK
> az group list

# Get the access token
# Decode it at https://jwt.ms and check claims
#   - "xms_cc": ["CP1"]
#   - "xms_ssm": "1" 
> az account get-access-token

# Revoke the session
> az rest -m POST -u https://graph.microsoft.com/v1.0/me/revokeSignInSessions

# Wait several minute for the session revocation to propagate

# A failed command using Track 2 SDK
> az storage account list
AADSTS50173: The provided grant has expired due to it being revoked, a fresh auth token is needed. The user might have changed or reset their password. The grant was issued on '2021-04-08T07:28:53.6808518Z' and the TokensValidFrom date (before which tokens are not valid) for this user is '2021-04-08T07:29:09.0000000Z'.
Trace ID: 686ab9c1-9991-4bc1-b353-279b2ea2ab01
Correlation ID: d1731352-800d-4b95-ae15-5e1999ce5d0b
Timestamp: 2021-04-08 07:53:44Z
To re-authenticate, please run:
az logout
az login
If the problem persists, please contact your tenant administrator.

# A failed command using Track 1 SDK
> az group list
Authentication failed.
The access token has expired or been revoked by Continuous Access Evaluation. Silent re-authentication will be attempted in the future.
To re-authenticate, please run:
az logout
az login
If the problem persists, please contact your tenant administrator.

Additional context

Due to MSAL caching issue AzureAD/microsoft-authentication-library-for-python#335, az logout is currently mandatory before calling az login again so that revoked access tokens can be purged from MSAL cache.

@yonzhan
Copy link
Collaborator

yonzhan commented Apr 8, 2021

CAE b3

@jiasli
Copy link
Member Author

jiasli commented Apr 9, 2021

Installation instruction:

python -m venv cae-venv

# PowerShell
. .\cae-venv\Scripts\Activate.ps1

# Bash
. cae-venv/bin/activate

python -m pip install --upgrade pip

pip install --extra-index-url https://azurecliedge.blob.core.windows.net/cae/simple/ azure-cli==2.21.0.1

@jiasli jiasli merged commit 3823c76 into Azure:beta Apr 12, 2021
@jiasli jiasli deleted the cae-b3 branch April 12, 2021 05:24
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 this pull request may close these issues.

2 participants