azure - EventHub 的 Azure 部署期间出现 429 错误

标签 azure deployment azure-resource-manager azure-eventhub azure-bicep

我正在部署一个 Bicep 模板,其中包含许多 IPFilterRules 和其他网络资源。

在部署期间,每个单独的资源都会收到 429 错误,然后一分钟后重试,有些资源成功,有些资源失败,最终在 5-10 分钟后全部成功。

以下是我如何创建 IP 过滤规则的示例:

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
    }
  }]
}

以下是出现错误时部署面板的外观:

429 errors

如何防止这些 429 错误发生?我可以增加一些限制以允许更多资源吗?或者有没有办法改变我的二头肌模板,以便一次创建一个资源,而不是一次创建所有资源?或者我可以使用任何其他技术来加速这个过程吗?

最佳答案

您可以使用 batchSize decorator 按顺序运行 ip 规则资源:

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
  }
}]

要立即应用配置,您可以使用 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: []
  }
}

关于azure - EventHub 的 Azure 部署期间出现 429 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72033890/

相关文章:

Azure、应用程序服务、站点在部署后显示消息 "This web app has been successfully created",尽管该站点在本地显示

c# - 使用表存储的 Azure 成员(member)资格提供商

python - Streamlit azure 部署请稍候屏幕错误

java - CloudBees:将同一 WAR 的 2 个不同版本部署到不同的应用程序实例

java - 如何像这样将 docker-compose 部署到网络上

azure - 如何使用 REST API 登录 Azure 门户

azure - 如何从 Azure DevOps YAML 管道访问 AzureResourceManagerTemplateDeployment (@3) 任务中的 "deploymentOutputs"?

用于传递日志信息的 Azure powershell 脚本

java - 将图像上传到 android 中的 azure blob 存储时出现 nullpointerException

powershell - 使用 SAS token 上传 Blob 内容