【Azure Developer】azd 安装最新版无法登录中国区问题二:本地Windows环境遇问题

问题描述

在本地windows环境中,安装了azd(Azure Developer CLI)最新版后,遇见无法登录Azure中国区。报错和之前在devops的pipeline上错误一样(DevOps上的报错文章请参考:https://www.cnblogs.com/lulight/p/19149913)。

执行命令:

#配置azd命令执行环境为中国区Azure
azd config set cloud.name AzureChinaCloud

# 登录
azd up

报错信息:

ERROR: failed to authenticate: unable to resolve an endpoint: ResolveEndpoints(): TenantDiscoveryResponse: issuer from OIDC discovery 'https://login.partner.microsoftonline.cn/{tenantid}/v2.0' does not match authority 'https://login.chinacloudapi.cn/organizations/' or a known pattern

错误截图:

image

 

解决方法

最直接的办法是通过命令安装旧版本,比如1.19.0 。在测试使用命令 winget install microsoft.azd --version 1.19.0  安装失败。

image

最后,通过公网搜索的方式,找到老版本的azd 下载文档地址:Release azure-dev-cli_1.19.0 · Azure/azure-dev

image

 下载msi安装文件,本地安装后。再次使用azd up,就可以正常登录到中国区Azure

注:需要先执行 uninstall 命令卸载最新版本。 执行命令: winget uninstall microsoft.azd

登录成功!

image

 

 

 

 

参考资料

使用Azure Developer CLI (azd)部署项目时候遇见无法登录中国区Azure的报错 : https://www.cnblogs.com/lulight/p/19149913
Install or update the Azure Developer CLI: https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/install-azd?tabs=winget-windows%2Cbrew-mac%2Cscript-linux&pivots=os-windows
azure-dev-cli_1.19.0 : https://github.com/Azure/azure-dev/releases/tag/azure-dev-cli_1.19.0

 

posted @ 2025-11-11 19:58  路边两盏灯  阅读(7)  评论(0)    收藏  举报