将托管标识与 Azure 服务总线结合使用
我想使用托管标识连接到 Azure 服务总线。在文档中,他们提到了 DefaultAzureCredentialBuilder。我真的不明白这将如何使用我的托管身份来向服务总线进行身份验证。
有人知道这个吗?
I want to use a managed identity to connect to Azure Service Bus. In the docs they mention the DefaultAzureCredentialBuilder. I don't really get how this would use my managed identity to authenticate to the Service Bus.
Does anyone know this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
DefaultAzureCredential
是一个链式凭据;在内部,它考虑多个授权源,包括托管身份。更多信息可以在 Azure.Identity 概述。服务总线可以使用任何 Azure.Identity 凭据 用于授权。演示
DefaultAzureCredentialBuilder
只是因为它可以在各种场景中取得成功。如果您希望将授权限制为仅托管身份,则可以使用
ManagedIdentityCredentialBuilder
而不是默认凭据来实现。可以找到创建的示例 此处。然后可以按照与默认凭据相同的方式将其传递到服务总线。DefaultAzureCredential
is a chained credential; internally it considers multiple authorization sources, including managed identities. More information can be found in the Azure.Identity overview.Service Bus can use any of the Azure.Identity credentials for authorization.
DefaultAzureCredentialBuilder
is demonstrated only because it allows for success in a variety of scenarios.If you'd prefer to restrict authorization to only a managed identity, you can do so by using
ManagedIdentityCredentialBuilder
rather than the default credential. An example of creating the can be found here. It can then be passed to Service Bus in the same manner as the default credential.