0
votes

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.

I have verified my TenantId, ClientId, ClientSecret, SubscriptionId and namespace name several times and they seem correct to me. My service bus pricing tier is "Standard".

1

1 Answers

0
votes

According to the error, seems you did not add your service principal as a role to your service bus.

You could follow the steps:

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.