创建服务总线主题请求给出异常操作返回了无效的状态码“禁止”

 收藏

When I try to create a service bus topic programmatically using the sample app (https://github.com/Azure-Samples/service-bus-dotnet-management), Azure gives Operation returned an invalid status code 'Forbidden' exception.

我已经多次验证我的TenantId,ClientId,ClientSecret,SubscriptionId和名称空间名称,它们对我来说似乎是正确的。我的服务总线定价层是“标准”。

回复
  • lenim 回复

    根据错误,似乎您没有将服务主体作为角色添加到服务总线中。

    您可以按照以下步骤操作:

    Navigate to the azure portal -> your service bus or the subscription whcih your service bus located -> Access control (IAM) -> Add -> Add role assignment -> search your service principal with name and add it as a role(e.g. Owner) -> Save.

    For more details, refer to this link.