Microsoft.EventHub 命名空間/eventhubs/authorizationRules 2014-09-01

Bicep 資源定義

命名空間/eventhubs/authorizationRules 資源類型可以使用目標作業來部署:

如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄檔。

使用範例

Bicep 範例

在事件中樞內部署事件中樞授權規則的基本範例。

param location string = 'westeurope'
param resourceName string = 'acctest0001'

resource namespace 'Microsoft.EventHub/namespaces@2022-01-01-preview' = {
  name: resourceName
  location: location
  sku: {
    capacity: 1
    name: 'Basic'
    tier: 'Basic'
  }
  properties: {
    disableLocalAuth: false
    isAutoInflateEnabled: false
    publicNetworkAccess: 'Enabled'
    zoneRedundant: false
  }
}

resource eventhub 'Microsoft.EventHub/namespaces/eventhubs@2021-11-01' = {
  name: resourceName
  parent: namespace
  properties: {
    messageRetentionInDays: 1
    partitionCount: 2
    status: 'Active'
  }
}

resource authorizationRule 'Microsoft.EventHub/namespaces/eventhubs/authorizationRules@2021-11-01' = {
  name: resourceName
  parent: eventhub
  properties: {
    rights: [
      'Send'
    ]
  }
}

Azure 已驗證的模組

下列 Azure 驗證模組 可用來部署此資源類型。

Module Description
Event Hub 命名空間 - Eventhub - 授權規則 AVM 事件中心命名空間子模組 - Eventhub - 授權規則

Azure 快速入門範例

下列 Azure 快速入門範本 包含用於部署此資源類型的 Bicep 範例。

Bicep 檔案 Description
Moesif API分析和獲利 此範本會將來自 Azure API 管理的 API 呼叫記錄至 Moesif API 分析和獲利平臺

資源格式

若要建立 Microsoft.EventHub/namespaces/eventhubs/authorizationRules 資源,請將下列 Bicep 新增至範本。

resource symbolicname 'Microsoft.EventHub/namespaces/eventhubs/authorizationRules@2014-09-01' = {
  parent: resourceSymbolicName
  location: 'string'
  name: 'string'
  properties: {
    rights: [
      'string'
    ]
  }
}

屬性值

Microsoft.EventHub/namespaces/eventhubs/authorizationRules

Name Description Value
位置 數據中心位置。 字串
name 資源名稱 string

Constraints:
最小長度 = 1
最大長度 = 50 (必要)
父代 在 Bicep 中,您可以指定子資源的父資源。 只有在父資源外部宣告子資源時,才需要新增這個屬性。

如需詳細資訊,請參閱 父資源外部的子資源。
類型的資源符號名稱:命名空間/eventhubs
properties 提供用來建立或更新 SharedAccessAuthorizationRule 的屬性 SharedAccessAuthorizationRuleProperties

SharedAccessAuthorizationRuleProperties

Name Description Value
rights 與規則相關聯的許可權。 包含任何的字串數組:
'Listen'
'Manage'
「傳送」(必填)

ARM 樣本資源定義

命名空間/eventhubs/authorizationRules 資源類型可以使用目標作業來部署:

使用範例

Azure 快速入門範本

下列 Azure 快速入門範本 部署此資源類型。

Template Description
Moesif API分析和獲利

部署至 Azure
此範本會將來自 Azure API 管理的 API 呼叫記錄至 Moesif API 分析和獲利平臺

資源格式

若要建立 Microsoft.EventHub/namespaces/eventhubs/authorizationRules 資源,請將下列 JSON 新增至範本。

{
  "type": "Microsoft.EventHub/namespaces/eventhubs/authorizationRules",
  "apiVersion": "2014-09-01",
  "name": "string",
  "location": "string",
  "properties": {
    "rights": [ "string" ]
  }
}

屬性值

Microsoft.EventHub/namespaces/eventhubs/authorizationRules

Name Description Value
apiVersion API 版本 '2014-09-01'
位置 數據中心位置。 字串
name 資源名稱 string

Constraints:
最小長度 = 1
最大長度 = 50 (必要)
properties 提供用來建立或更新 SharedAccessAuthorizationRule 的屬性 SharedAccessAuthorizationRuleProperties
型別 資源類型 'Microsoft.EventHub/namespaces/eventhubs/authorizationRules'

SharedAccessAuthorizationRuleProperties

Name Description Value
rights 與規則相關聯的許可權。 包含任何的字串數組:
'Listen'
'Manage'
「傳送」(必填)

Terraform (AzAPI 提供者) 資源定義

命名空間/eventhubs/authorizationRules 資源類型可以使用目標作業來部署:

  • 資源團體 關於每個 API 版本變更屬性的清單,請參見 變更日誌。

使用範例

Terraform 範例

在事件中樞內部署事件中樞授權規則的基本範例。

terraform {
  required_providers {
    azapi = {
      source = "Azure/azapi"
    }
  }
}

provider "azapi" {
  skip_provider_registration = false
}

variable "resource_name" {
  type    = string
  default = "acctest0001"
}

variable "location" {
  type    = string
  default = "westeurope"
}

resource "azapi_resource" "resourceGroup" {
  type     = "Microsoft.Resources/resourceGroups@2020-06-01"
  name     = var.resource_name
  location = var.location
}

resource "azapi_resource" "namespace" {
  type      = "Microsoft.EventHub/namespaces@2022-01-01-preview"
  parent_id = azapi_resource.resourceGroup.id
  name      = var.resource_name
  location  = var.location
  body = {
    properties = {
      disableLocalAuth     = false
      isAutoInflateEnabled = false
      publicNetworkAccess  = "Enabled"
      zoneRedundant        = false
    }
    sku = {
      capacity = 1
      name     = "Basic"
      tier     = "Basic"
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

resource "azapi_resource" "eventhub" {
  type      = "Microsoft.EventHub/namespaces/eventhubs@2021-11-01"
  parent_id = azapi_resource.namespace.id
  name      = var.resource_name
  body = {
    properties = {
      messageRetentionInDays = 1
      partitionCount         = 2
      status                 = "Active"
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

resource "azapi_resource" "authorizationRule" {
  type      = "Microsoft.EventHub/namespaces/eventhubs/authorizationRules@2021-11-01"
  parent_id = azapi_resource.eventhub.id
  name      = var.resource_name
  body = {
    properties = {
      rights = [
        "Send",
      ]
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

資源格式

若要建立 Microsoft.EventHub/namespaces/eventhubs/authorizationRules 資源,請將下列 Terraform 新增至範本。

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.EventHub/namespaces/eventhubs/authorizationRules@2014-09-01"
  name = "string"
  parent_id = "string"
  location = "string"
  body = {
    properties = {
      rights = [
        "string"
      ]
    }
  }
}

屬性值

Microsoft.EventHub/namespaces/eventhubs/authorizationRules

Name Description Value
位置 數據中心位置。 字串
name 資源名稱 string

Constraints:
最小長度 = 1
最大長度 = 50 (必要)
parent_id 此資源為父系之資源的標識碼。 類型資源的標識碼:命名空間/eventhubs
properties 提供用來建立或更新 SharedAccessAuthorizationRule 的屬性 SharedAccessAuthorizationRuleProperties
型別 資源類型 "Microsoft.EventHub/namespaces/eventhubs/authorizationRules@2014-09-01"

SharedAccessAuthorizationRuleProperties

Name Description Value
rights 與規則相關聯的許可權。 包含任何的字串數組:
'Listen'
'Manage'
「傳送」(必填)