I am deploying an Bicep template which contains a number of IPFilterRules and other network resources.
During the Deployment each individual resource is getting a 429 error, it then retries a minute later and some more succeed and some more fail and then eventually after 5-10 minutes they all succeed.
Here is an example of how I'm creating my ip filter rules:
resource EventHubNamespace 'Microsoft.EventHub/namespaces@2021-06-01-preview' = {
// ...
resource IpFilterRules 'ipfilterrules@2018-01-01-preview' = [for ip in companyIps: {
name: uniqueString(resourceGroup().name, ip)
properties: {
action: 'Accept'
ipMask: ip
}
}]
}
Here is what the Deployment panel looks like while erroring:
How can I prevent these 429 errors from happening? Can I increase some limit to allow for a more resources? Or is there a way to alter my bicep template so these resources are created 1 at a time instead of all at once? Or is there any other technique I could use to speed up this process?
CodePudding user response:
You can run the ip rules resource sequentially by using the batchSize decorator:
resource EventHubNamespace 'Microsoft.EventHub/namespaces@2021-06-01-preview' = {
...
}
@batchSize(1)
resource IpFilterRules 'Microsoft.EventHub/namespaces/ipfilterrules@2018-01-01-preview' = [for ip in companyIps: {
name: uniqueString(resourceGroup().name, ip)
parent: EventHubNamespace
properties: {
action: 'Accept'
ipMask: ip
}
}]
To apply the configuration at once, you could use a networkRuleSets:
resource NetworkRuleSet 'Microsoft.EventHub/namespaces/networkRuleSets@2021-06-01-preview' = {
name: 'default'
parent: EventHubNamespace
properties: {
defaultAction: 'Allow'
ipRules: [for ip in companyIps: {
action: 'Allow'
ipMask: ip
}]
publicNetworkAccess: 'Enabled'
trustedServiceAccessEnabled: true
virtualNetworkRules: []
}
}