azure - vscode azure 应用程序配置 403 禁止

标签 azure oauth-2.0 azure-active-directory azure-app-configuration azure-identity

我正在 mac 上使用 vscode 开发一个 c# azure 函数应用程序。我安装了 Azure 扩展,并使用它登录到 azure。

我有一个集成测试,尝试从应用程序配置中读取数据,如下所示:

string endpoint = "https://<myappconfigendpoint>.azconfig.io";
var client = new ConfigurationClient(new Uri(endpoint), new DefaultAzureCredential());

string settingKey = "func-amx-api:TimeOfLastPoll";
ConfigurationSetting settingRead = client.GetConfigurationSetting(settingKey);

包含“client.GetConfigurationSetting”的行失败并出现 403 禁止错误。

使用 ProxyMan(如 Fiddler),我复制了呈现给应用程序配置端点的不记名 token 。我将其粘贴到 https://jwt.ms 中并确认“aud”和“upn”值看起来是正确的。 aud 包含应用程序配置端点,upn 是我的用户主体 - 它在应用程序配置上具有“应用程序配置数据所有者”的角色分配。

我的测试项目包含以下 nuget 包:

<PackageReference Include="Azure.Data.AppConfiguration" Version="1.2.0" />
<PackageReference Include="Azure.Identity" Version="1.9.0" />

最佳答案

这肯定是一个时间问题。在我再次为我的帐户进行应用配置的角色分配后,可能出现了延迟。

午餐后我运行了相同的代码,它成功了!

关于azure - vscode azure 应用程序配置 403 禁止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76235284/

相关文章:

azure - 数据工厂 - 集成运行时状态警报

security - 使用 JWT 进行应用身份验证和授权

azure - Azure 相当于 Google Cloud 的服务帐户是什么

azure-active-directory - Azure B2C 持久性 Cookie

azure - 如果我想通过 azure 函数查看 Kibana 日志,我应该在哪里安装 Filebeat?

azure - 无法通过 Azure Powershell 在新应用程序注册模块中设置 "preAuthorizedApplications"对象

azure - com.azure.storage.blob.* 和 com.microsoft.azure.storage.blob.* 之间的区别

oauth-2.0 - Google Oauth2 API - 无刷新 token

java - 捕获并增强LockedException和DisabledException

c# - Microsoft Graph Api - 请求 Me.Photo 时没有权限访问 token