I am creating an Azure Service Bus with the Fluent SDK. I want to give my service bus a specific name and increment by one if the name is unavailable. The problem I am having is that I don't actually know if the name is unavailable at the time of creation.
I'm using this to create a service bus:
var serviceBusNamespace = azure.ServiceBusNamespaces
.Define(serviceBusName)
.WithRegion(Region)
.WithExistingResourceGroup(resourceGroup)
.WithSku(NamespaceSku.Standard)
.Create();
If I run this code for two different resource groups using the same serviceBusName
, I get a service bus created in both resources groups without error. However when I go to the Azure portal the first service bus opens fine, but I get an error saying 'Not Found' when trying to open the second.
I understand that servicebus names must be unique across all of Azure, but
- Why is the Fluent SDK allowing me to create the second service bus with the same name?
- How can I check of the name is unique before creating the service bus?
I tried to ping the service bus URL to see if it exists. For example I tried this, for a URL like serviceBusName.servicebus.windows.net
, but that failed.