Creating Service Bus with exported ARM - Create/Update of a $Default rule is not allowed

Viewed 1043

I have created "Standard" tier Service Bus in Azure Portal. I Created Topic and subscription as well. I exported ARM template.

I execute with PowerShell to re-create Service Bus with ARM. I have changed name. I do get Service Bus succesfully created to Azure, but I'm wondering I do I get these errors:

Should I remove rules like ""type": "Microsoft.ServiceBus/namespaces/networkRuleSets"," which were automatically added to Export of ARM?

ERROR:

New-AzResourceGroupDeployment : 10.02.54 - Resource 
Microsoft.ServiceBus/namespaces/topics/subscriptions/rules 
'digiservicebusdev/newprofiletopic/newprofilesubscription/$Default' fa
iled with message '{
"error": {
"message": "Create/Update of a $Default rule is not allowed. CorrelationId: 6e135ad8-1bf2-4a33-b088- 
ef6003c025be",
"code": "BadRequest"
}
}'
At C:\Azure\ServiceBusARM\SBARM.ps1:12 char:1
+ New-AzResourceGroupDeployment `
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [New-AzResourceGroupDeployment], Exception
+ FullyQualifiedErrorId : 
Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet

New-AzResourceGroupDeployment : 10.02.55 - Resource Microsoft.ServiceBus/namespaces/networkRuleSet   
s 'servicebusdev/default' failed with message '{
"error": {
"message": "Network Rules are available only on a Premium Messaging namespace. CorrelationId: 
11135ad8-1bf2-4a33-b088-ef6003c025be",
"code": "BadRequest"
 }
}'
At C:\Azure\ServiceBusARM\SBARM.ps1:12 char:1
+ New-AzResourceGroupDeployment `
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [New-AzResourceGroupDeployment], Exception
+ FullyQualifiedErrorId : 
Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet
2 Answers

Should I remove rules like ""type": "Microsoft.ServiceBus/namespaces/networkRuleSets"," which were automatically added to Export of ARM?

Yes, removing the (automatically generated) networkRuleSets object from the ARM template is required when you want to deploy the Service Bus in the Standard Tier.

I test in my site and can reproduce your problem.

Each newly created topic subscription has an initial default subscription rule. If you don't explicitly specify a filter condition for the rule, the applied filter is the true filter that enables all messages to be selected into the subscription. The default rule has no associated annotation action.

I suspect this would be a server-side change involved to not create a default rules, hence the push back. For more details, you could refer to this issue.

Related