Rules - Create Or Update
Creates a new rule and updates an existing rule
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}?api-version=2021-11-01
URI Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
|
namespace
|
path | True |
|
The namespace name |
|
resource
|
path | True |
|
Name of the Resource group within the Azure subscription. |
|
rule
|
path | True |
|
The rule name. |
|
subscription
|
path | True |
|
Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. |
|
subscription
|
path | True |
|
The subscription name. |
|
topic
|
path | True |
|
The topic name. |
|
api-version
|
query | True |
|
Client API version. |
Request Body
| Name | Type | Description |
|---|---|---|
| properties.action |
Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression. |
|
| properties.correlationFilter |
Properties of correlationFilter |
|
| properties.filterType |
Filter type that is evaluated against a BrokeredMessage. |
|
| properties.sqlFilter |
Properties of sqlFilter |
Responses
| Name | Type | Description |
|---|---|---|
| 200 OK |
Rule created. |
|
| Other Status Codes |
ServiceBus 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
|
Rules |
|
Rules |
|
Rules |
RulesCreateCorrelationFilter
Sample Request
PUT https://management.azure.com/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ServiceBus/namespaces/sdk-Namespace-1319/topics/sdk-Topics-2081/subscriptions/sdk-Subscriptions-8691/rules/sdk-Rules-6571?api-version=2021-11-01
{
"properties": {
"filterType": "CorrelationFilter",
"correlationFilter": {
"properties": {
"topicHint": "Crop"
}
}
}
}
Sample Response
{
"id": "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ServiceBus/namespaces/sdk-Namespace-1319/topics/sdk-Topics-2081/subscriptions/sdk-Subscriptions-8691/rules/sdk-Rules-6571",
"name": "sdk-Rules-6571",
"type": "Microsoft.ServiceBus/Namespaces/Topics/Subscriptions/Rules",
"properties": {
"action": {},
"filterType": "CorrelationFilter",
"correlationFilter": {
"properties": {
"queueHint": "Crop"
}
}
}
}
RulesCreateOrUpdate
Sample Request
PUT https://management.azure.com/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ServiceBus/namespaces/sdk-Namespace-1319/topics/sdk-Topics-2081/subscriptions/sdk-Subscriptions-8691/rules/sdk-Rules-6571?api-version=2021-11-01
{}
Sample Response
{
"id": "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ServiceBus/namespaces/sdk-Namespace-1319/topics/sdk-Topics-2081/subscriptions/sdk-Subscriptions-8691/rules/sdk-Rules-6571",
"name": "sdk-Rules-6571",
"type": "Microsoft.ServiceBus/Namespaces/Topics/Subscriptions/Rules",
"properties": {
"action": {},
"filterType": "SqlFilter",
"sqlFilter": {
"sqlExpression": "1=1",
"compatibilityLevel": 20
}
}
}
RulesCreateSqlFilter
Sample Request
PUT https://management.azure.com/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ServiceBus/namespaces/sdk-Namespace-1319/topics/sdk-Topics-2081/subscriptions/sdk-Subscriptions-8691/rules/sdk-Rules-6571?api-version=2021-11-01
{
"properties": {
"filterType": "SqlFilter",
"sqlFilter": {
"sqlExpression": "myproperty=test"
}
}
}
Sample Response
{
"id": "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ServiceBus/namespaces/sdk-Namespace-1319/topics/sdk-Topics-2081/subscriptions/sdk-Subscriptions-8691/rules/sdk-Rules-6571",
"name": "sdk-Rules-6571",
"type": "Microsoft.ServiceBus/Namespaces/Topics/Subscriptions/Rules",
"properties": {
"action": {},
"filterType": "SqlFilter",
"sqlFilter": {
"sqlExpression": "myproperty=test",
"compatibilityLevel": 20
}
}
}
Definitions
| Action |
Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression. |
|
Correlation |
Represents the correlation filter expression. |
|
created |
The type of identity that created the resource. |
| Error |
The error object. |
|
Error |
The resource management error additional info. |
|
Error |
The resource management error response. |
|
Filter |
Rule filter types |
| Rule |
Description of Rule Resource. |
|
Sql |
Represents a filter which is a composition of an expression and an action that is executed in the pub/sub pipeline. |
|
system |
Metadata pertaining to creation and last modification of the resource. |
Action
Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression.
| Name | Type | Default Value | Description |
|---|---|---|---|
| compatibilityLevel |
|
This property is reserved for future use. An integer value showing the compatibility level, currently hard-coded to 20. |
|
| requiresPreprocessing |
|
True |
Value that indicates whether the rule action requires preprocessing. |
| sqlExpression |
|
SQL expression. e.g. MyProperty='ABC' |
CorrelationFilter
Represents the correlation filter expression.
| Name | Type | Default Value | Description |
|---|---|---|---|
| contentType |
|
Content type of the message. |
|
| correlationId |
|
Identifier of the correlation. |
|
| label |
|
Application specific label. |
|
| messageId |
|
Identifier of the message. |
|
| properties |
|
dictionary object for custom filters |
|
| replyTo |
|
Address of the queue to reply to. |
|
| replyToSessionId |
|
Session identifier to reply to. |
|
| requiresPreprocessing |
|
True |
Value that indicates whether the rule action requires preprocessing. |
| sessionId |
|
Session identifier. |
|
| to |
|
Address to send to. |
createdByType
The type of identity that created the resource.
| Name | Type | Description |
|---|---|---|
| Application |
|
|
| Key |
|
|
| ManagedIdentity |
|
|
| User |
|
Error
The error object.
| Name | Type | Description |
|---|---|---|
| additionalInfo |
The error additional info. |
|
| code |
|
The error code. |
| details |
The error details. |
|
| message |
|
The error message. |
| target |
|
The error target. |
ErrorAdditionalInfo
The resource management error additional info.
| Name | Type | Description |
|---|---|---|
| info |
|
The additional info. |
| type |
|
The additional info type. |
ErrorResponse
The resource management error response.
| Name | Type | Description |
|---|---|---|
| error |
The error object. |
FilterType
Rule filter types
| Name | Type | Description |
|---|---|---|
| CorrelationFilter |
|
|
| SqlFilter |
|
Rule
Description of Rule Resource.
| Name | Type | Description |
|---|---|---|
| id |
|
Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} |
| location |
|
The geo-location where the resource lives |
| name |
|
The name of the resource |
| properties.action |
Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression. |
|
| properties.correlationFilter |
Properties of correlationFilter |
|
| properties.filterType |
Filter type that is evaluated against a BrokeredMessage. |
|
| properties.sqlFilter |
Properties of sqlFilter |
|
| systemData |
The system meta data relating to this resource. |
|
| type |
|
The type of the resource. E.g. "Microsoft.EventHub/Namespaces" or "Microsoft.EventHub/Namespaces/EventHubs" |
SqlFilter
Represents a filter which is a composition of an expression and an action that is executed in the pub/sub pipeline.
| Name | Type | Default Value | Description |
|---|---|---|---|
| compatibilityLevel |
|
This property is reserved for future use. An integer value showing the compatibility level, currently hard-coded to 20. |
|
| requiresPreprocessing |
|
True |
Value that indicates whether the rule action requires preprocessing. |
| sqlExpression |
|
The SQL expression. e.g. MyProperty='ABC' |
systemData
Metadata pertaining to creation and last modification of the resource.
| Name | Type | Description |
|---|---|---|
| createdAt |
|
The timestamp of resource creation (UTC). |
| createdBy |
|
The identity that created the resource. |
| createdByType |
The type of identity that created the resource. |
|
| lastModifiedAt |
|
The type of identity that last modified the resource. |
| lastModifiedBy |
|
The identity that last modified the resource. |
| lastModifiedByType |
The type of identity that last modified the resource. |