Hyphen in Resource Name
When creating the resource in the Azure Portal a hyphen (-) passes validation in the resource name and the resource is successfully created.
When publishing to the resource using the hub name containing the hyphen the following error is received:
Unhandled exception. Azure.RequestFailedException: Service request failed. Status: 400 (Bad Request)
Content: aracters can be letters, digits or the following symbols _`,.[] Headers: Server: nginx Date: Wed, 04 Aug 2021 09:41:41 GMT Transfer-Encoding: chunked Connection: keep-alive Content-Type: text/plain; charset=utf-8
resource names are allowed to contain hyphen (-) but the hub name does not, hub name should only contain alpha-numeric (0-9, a-z, A-Z) characters or underscore (_)
You don't need hub name to be the same as the resource name.
I was highlighting a discrepancy between what can be provisioned in Azure, and what the Azure.Messaging.WebPubSub package supports.
Get it. Since they are used in different places they follow different rules. For example, the resource name will be used as part of the domain name of the resource. And for Hubs, we try to prevent the characters that are not allowed in C# class naming so that in the future it gives us the flexibility to provide more powerful server SDKs, for example, mapping classes into Hubs.