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=2024-01-01
URI Parameters
Name | In | Required | Type | Description |
---|---|---|---|---|
namespace
|
path | True |
string |
The namespace name |
resource
|
path | True |
string |
The name of the resource group. The name is case insensitive. |
rule
|
path | True |
string |
The rule name. |
subscription
|
path | True |
string |
Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. |
subscription
|
path | True |
string |
The subscription name. |
topic
|
path | True |
string |
The topic name. |
api-version
|
query | True |
string |
The API version to use for this operation. |
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=2024-01-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=2024-01-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=2024-01-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
Name | Description |
---|---|
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 |
integer |
This property is reserved for future use. An integer value showing the compatibility level, currently hard-coded to 20. |
|
requiresPreprocessing |
boolean |
True |
Value that indicates whether the rule action requires preprocessing. |
sqlExpression |
string |
SQL expression. e.g. MyProperty='ABC' |
CorrelationFilter
Represents the correlation filter expression.
Name | Type | Default value | Description |
---|---|---|---|
contentType |
string |
Content type of the message. |
|
correlationId |
string |
Identifier of the correlation. |
|
label |
string |
Application specific label. |
|
messageId |
string |
Identifier of the message. |
|
properties |
object |
dictionary object for custom filters |
|
replyTo |
string |
Address of the queue to reply to. |
|
replyToSessionId |
string |
Session identifier to reply to. |
|
requiresPreprocessing |
boolean |
True |
Value that indicates whether the rule action requires preprocessing. |
sessionId |
string |
Session identifier. |
|
to |
string |
Address to send to. |
createdByType
The type of identity that created the resource.
Name | Type | Description |
---|---|---|
Application |
string |
|
Key |
string |
|
ManagedIdentity |
string |
|
User |
string |
Error
The error object.
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. |
ErrorAdditionalInfo
The resource management error additional info.
Name | Type | Description |
---|---|---|
info |
object |
The additional info. |
type |
string |
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 |
string |
|
SqlFilter |
string |
Rule
Description of Rule Resource.
Name | Type | Description |
---|---|---|
id |
string |
Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} |
location |
string |
The geo-location where the resource lives |
name |
string |
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 |
string |
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 |
integer |
This property is reserved for future use. An integer value showing the compatibility level, currently hard-coded to 20. |
|
requiresPreprocessing |
boolean |
True |
Value that indicates whether the rule action requires preprocessing. |
sqlExpression |
string |
The SQL expression. e.g. MyProperty='ABC' |
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 type of identity that last modified the resource. |
lastModifiedBy |
string |
The identity that last modified the resource. |
lastModifiedByType |
The type of identity that last modified the resource. |