通过App Service获取Azure Maps令牌时遇AADSTS50173认证错误
解决Azure CLI身份验证失败(AADSTS50173)问题
错误信息
"Azure CLI authentication failed due to an unknown error. See the troubleshooting guide for more information. https://aka.ms/azsdk/net/identity/azclicredential/troubleshoot ERROR: 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 '2022-12-13T05:31:55.3867300Z' and the TokensValidFrom date (before which tokens are not valid) for this user is '2023-01-28T06:51:55.0000000Z'.
错误原因
该错误核心是Azure CLI缓存的身份授权令牌已被撤销失效,通常由用户修改或重置密码引发——新令牌的生效时间晚于旧令牌的颁发时间,导致旧令牌无法继续使用。
解决步骤
- 重新登录Azure CLI,执行命令:
az login,按提示完成身份验证流程,获取新的有效令牌。 - 若在App Service环境中使用该身份验证方式,需检查并更新App Service的身份配置,避免依赖本地缓存的旧令牌。
- 执行
az account show命令,确认当前登录账号有效,令牌已成功更新。
内容的提问来源于stack exchange,提问作者harinsamaranayake
相关产品推荐
相关产品推荐

