连接到中国Azure的KeyVault
我将此代码用于 Azure KeyVault 服务,它与常规 Azure 配合良好
ClientSecretCredential clientCredential = new(options.KeyVaultTenantId, options.KeyVaultClientId, options.KeyVaultClientSecret);
KeyVaultCertificateWithPolicy rootCertificate = new CertificateClient(vaultUri, _clientCredential).GetCertificate(_rootCertificateId).Value;
,但我需要连接到 Azure 中国。代码失败并显示消息:
AADSTS90002:找不到租户“xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx”。 检查以确保您拥有正确的租户 ID 并登录到正确的云。 请咨询您的订阅管理员,如果有,则可能会发生这种情况 租户没有有效订阅
,但我不知道在哪里在我的代码中设置 ActiveDirectoryServiceSettings.AzureChina
。请建议
<PackageReference Include="Azure.Identity" Version="1.5.0" />
<PackageReference Include="Azure.Security.KeyVault.Certificates" Version="4.2.0" />
<PackageReference Include="Azure.Security.KeyVault.Keys" Version="4.2.0" />
<PackageReference Include="Azure.Security.KeyVault.Secrets" Version="4.2.0" />
I use this code for Azure KeyVault Service and it works well with a regular Azure
ClientSecretCredential clientCredential = new(options.KeyVaultTenantId, options.KeyVaultClientId, options.KeyVaultClientSecret);
KeyVaultCertificateWithPolicy rootCertificate = new CertificateClient(vaultUri, _clientCredential).GetCertificate(_rootCertificateId).Value;
however I need to connect to Azure China. The code fails with message:
AADSTS90002: Tenant 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' not found.
Check to make sure you have the correct tenant ID and are signing into the correct cloud.
Check with your subscription administrator, this may happen if there
are no active subscriptions for the tenant
I found this but I don't know where to set ActiveDirectoryServiceSettings.AzureChina
in my code. Please suggest
<PackageReference Include="Azure.Identity" Version="1.5.0" />
<PackageReference Include="Azure.Security.KeyVault.Certificates" Version="4.2.0" />
<PackageReference Include="Azure.Security.KeyVault.Keys" Version="4.2.0" />
<PackageReference Include="Azure.Security.KeyVault.Secrets" Version="4.2.0" />
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要使用
clients eptercretcredential(字符串,字符串,字符串,client并设置
pertiateHost
clientsecretcredentialOptions
。像:
You would need to use
ClientSecretCredential(String, String, String, ClientSecretCredentialOptions)
constructor override and set theAuthorityHost
to Azure China inClientSecretCredentialOptions
.Something like: