Web Pub Sub Hubs - Create Or Update
Create or update a hub setting.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/hubs/{hubName}?api-version=2023-02-01
URI Parameters
Name | In | Required | Type | Description |
---|---|---|---|---|
hub
|
path | True |
string |
The hub name. |
resource
|
path | True |
string |
The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. |
resource
|
path | True |
string |
The name of the resource. |
subscription
|
path | True |
string |
Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. |
api-version
|
query | True |
string |
Client Api Version. |
Request Body
Name | Required | Type | Description |
---|---|---|---|
properties | True |
Properties of a hub. |
Responses
Name | Type | Description |
---|---|---|
200 OK |
OK.The request makes no change. The response describes the existing hub setting. |
|
201 Created |
Created. The response describes the hub setting and contains a Location header to query the operation result. |
|
Other Status Codes |
Error response describing why the operation failed. |
Security
azure_auth
Azure Active Directory OAuth2 Flow
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name | Description |
---|---|
user_impersonation | impersonate your user account |
Examples
WebPubSubHubs_CreateOrUpdate
Sample Request
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.SignalRService/webPubSub/myWebPubSubService/hubs/exampleHub?api-version=2023-02-01
{
"properties": {
"eventHandlers": [
{
"urlTemplate": "http://host.com",
"userEventPattern": "*",
"systemEvents": [
"connect",
"connected"
],
"auth": {
"type": "ManagedIdentity",
"managedIdentity": {
"resource": "abc"
}
}
}
],
"eventListeners": [
{
"filter": {
"type": "EventName",
"systemEvents": [
"connected",
"disconnected"
],
"userEventPattern": "*"
},
"endpoint": {
"type": "EventHub",
"fullyQualifiedNamespace": "example.servicebus.windows.net",
"eventHubName": "eventHubName1"
}
}
],
"anonymousConnectPolicy": "allow"
}
}
Sample Response
{
"properties": {
"eventHandlers": [
{
"urlTemplate": "http://host.com",
"userEventPattern": "*",
"systemEvents": [
"connect",
"connected"
],
"auth": {
"type": "ManagedIdentity",
"managedIdentity": {
"resource": "abc"
}
}
}
],
"eventListeners": [
{
"filter": {
"type": "EventName",
"systemEvents": [
"connected",
"disconnected"
],
"userEventPattern": "*"
},
"endpoint": {
"type": "EventHub",
"fullyQualifiedNamespace": "example.servicebus.windows.net",
"eventHubName": "eventHubName1"
}
}
],
"anonymousConnectPolicy": "allow"
},
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/hubs/exampleHub",
"name": "exampleHub",
"type": "Microsoft.SignalRService/WebPubSub/hubs"
}
Location: https://management.azure.com/subscriptions/subid/providers/Microsoft.SignalRService/...pathToOperationResult...
Azure-AsyncOperation: https://management.azure.com/subscriptions/subid/providers/Microsoft.SignalRService/...pathToOperationStatus...
{
"properties": {
"eventHandlers": [
{
"urlTemplate": "http://host.com",
"userEventPattern": "*",
"systemEvents": [
"connect",
"connected"
],
"auth": {
"type": "ManagedIdentity",
"managedIdentity": {
"resource": "abc"
}
}
}
],
"eventListeners": [
{
"filter": {
"type": "EventName",
"systemEvents": [
"connected",
"disconnected"
],
"userEventPattern": "*"
},
"endpoint": {
"type": "EventHub",
"fullyQualifiedNamespace": "example.servicebus.windows.net",
"eventHubName": "eventHubName1"
}
}
],
"anonymousConnectPolicy": "allow"
},
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/hubs/exampleHub",
"name": "exampleHub",
"type": "Microsoft.SignalRService/WebPubSub/hubs"
}
Definitions
Name | Description |
---|---|
created |
The type of identity that created the resource. |
Error |
The resource management error additional info. |
Error |
The error detail. |
Error |
Error response |
Event |
Properties of event handler. |
Event |
An Event Hub endpoint. The managed identity of Web PubSub service must be enabled, and the identity should have the "Azure Event Hubs Data sender" role to access Event Hub. |
Event |
A setting defines which kinds of events should be sent to which endpoint. |
Event |
Filter events by their name. |
Managed |
Managed identity settings for upstream. |
system |
Metadata pertaining to creation and last modification of the resource. |
Upstream |
Upstream auth settings. If not set, no auth is used for upstream messages. |
Upstream |
Upstream auth type enum. |
Web |
A hub setting |
Web |
Properties of a hub. |
createdByType
The type of identity that created the resource.
Name | Type | Description |
---|---|---|
Application |
string |
|
Key |
string |
|
ManagedIdentity |
string |
|
User |
string |
ErrorAdditionalInfo
The resource management error additional info.
Name | Type | Description |
---|---|---|
info |
object |
The additional info. |
type |
string |
The additional info type. |
ErrorDetail
The error detail.
Name | Type | Description |
---|---|---|
additionalInfo |
The error additional info. |
|
code |
string |
The error code. |
details |
The error details. |
|
message |
string |
The error message. |
target |
string |
The error target. |
ErrorResponse
Error response
Name | Type | Description |
---|---|---|
error |
The error object. |
EventHandler
Properties of event handler.
Name | Type | Description |
---|---|---|
auth |
Upstream auth settings. If not set, no auth is used for upstream messages. |
|
systemEvents |
string[] |
Gets or sets the list of system events. |
urlTemplate |
string |
Gets or sets the EventHandler URL template. You can use a predefined parameter {hub} and {event} inside the template, the value of the EventHandler URL is dynamically calculated when the client request comes in.
For example, UrlTemplate can be |
userEventPattern |
string |
Gets or sets the matching pattern for event names. There are 3 kinds of patterns supported: 1. "*", it matches any event name 2. Combine multiple events with ",", for example "event1,event2", it matches event "event1" and "event2" 3. A single event name, for example, "event1", it matches "event1" |
EventHubEndpoint
An Event Hub endpoint. The managed identity of Web PubSub service must be enabled, and the identity should have the "Azure Event Hubs Data sender" role to access Event Hub.
Name | Type | Description |
---|---|---|
eventHubName |
string |
The name of the Event Hub. |
fullyQualifiedNamespace |
string |
The fully qualified namespace name of the Event Hub resource. For example, "example.servicebus.windows.net". |
type |
string:
Event |
EventListener
A setting defines which kinds of events should be sent to which endpoint.
Name | Type | Description |
---|---|---|
endpoint | EventListenerEndpoint: |
An endpoint specifying where Web PubSub should send events to. |
filter | EventListenerFilter: |
A base class for event filter which determines whether an event should be sent to an event listener. |
EventNameFilter
Filter events by their name.
Name | Type | Description |
---|---|---|
systemEvents |
string[] |
Gets or sets a list of system events. Supported events: "connected" and "disconnected". Blocking event "connect" is not supported because it requires a response. |
type |
string:
Event |
|
userEventPattern |
string |
Gets or sets a matching pattern for event names. There are 3 kinds of patterns supported: 1. "*", it matches any event name 2. Combine multiple events with ",", for example "event1,event2", it matches events "event1" and "event2" 3. A single event name, for example, "event1", it matches "event1" |
ManagedIdentitySettings
Managed identity settings for upstream.
Name | Type | Description |
---|---|---|
resource |
string |
The Resource indicating the App ID URI of the target resource. It also appears in the aud (audience) claim of the issued token. |
systemData
Metadata pertaining to creation and last modification of the resource.
Name | Type | Description |
---|---|---|
createdAt |
string |
The timestamp of resource creation (UTC). |
createdBy |
string |
The identity that created the resource. |
createdByType |
The type of identity that created the resource. |
|
lastModifiedAt |
string |
The timestamp of resource last modification (UTC) |
lastModifiedBy |
string |
The identity that last modified the resource. |
lastModifiedByType |
The type of identity that last modified the resource. |
UpstreamAuthSettings
Upstream auth settings. If not set, no auth is used for upstream messages.
Name | Type | Description |
---|---|---|
managedIdentity |
Managed identity settings for upstream. |
|
type |
Upstream auth type enum. |
UpstreamAuthType
Upstream auth type enum.
Name | Type | Description |
---|---|---|
ManagedIdentity |
string |
|
None |
string |
WebPubSubHub
A hub setting
Name | Type | Description |
---|---|---|
id |
string |
Fully qualified resource Id for the resource. |
name |
string |
The name of the resource. |
properties |
Properties of a hub. |
|
systemData |
Metadata pertaining to creation and last modification of the resource. |
|
type |
string |
The type of the resource - e.g. "Microsoft.SignalRService/SignalR" |
WebPubSubHubProperties
Properties of a hub.
Name | Type | Default Value | Description |
---|---|---|---|
anonymousConnectPolicy |
string |
deny |
The settings for configuring if anonymous connections are allowed for this hub: "allow" or "deny". Default to "deny". |
eventHandlers |
Event handler of a hub. |
||
eventListeners |
Event listener settings for forwarding your client events to listeners. Event listener is transparent to Web PubSub clients, and it doesn't return any result to clients nor interrupt the lifetime of clients. One event can be sent to multiple listeners, as long as it matches the filters in those listeners. The order of the array elements doesn't matter. Maximum count of event listeners among all hubs is 10. |