[Schema Registry] Migrate to Bicep (#30850)
And also: - Update API versions - Be cloud-independent to allow running in sovereign clouds. Live tests run: - https://dev.azure.com/azure-sdk/internal/_build/results?buildId=4069965&view=results - https://dev.azure.com/azure-sdk/internal/_build/results?buildId=4070103&view=results
This commit is contained in:
Родитель
73d5edced4
Коммит
3335c5eb34
|
@ -0,0 +1,189 @@
|
|||
@minLength(4)
|
||||
param baseName string = resourceGroup().name
|
||||
param testApplicationOid string = 'b3653439-8136-4cd5-aac3-2a9460871ca6'
|
||||
param location string = resourceGroup().location
|
||||
param partitionsCount int = 4
|
||||
param retentionTimeInDays int = 1
|
||||
|
||||
var eventHubName = 'eventhub'
|
||||
var consumerGroupName = '$Default'
|
||||
var baseNameAvro = '${baseName}-avro'
|
||||
var baseNameJson = '${baseName}-json'
|
||||
var baseNameCustom = '${baseName}-custom'
|
||||
var schemaRegistryGroup = 'azsdk_js_test_group'
|
||||
var eventHubsDataOwnerRoleId = 'f526a384-b230-433a-b45c-95f59c4a2dec'
|
||||
|
||||
resource eventHubNamespaceAvro 'Microsoft.EventHub/namespaces@2024-01-01' = {
|
||||
name: baseNameAvro
|
||||
location: location
|
||||
sku: {
|
||||
name: 'Standard'
|
||||
tier: 'Standard'
|
||||
capacity: 5
|
||||
}
|
||||
properties: {
|
||||
zoneRedundant: false
|
||||
isAutoInflateEnabled: false
|
||||
maximumThroughputUnits: 0
|
||||
kafkaEnabled: true
|
||||
}
|
||||
}
|
||||
|
||||
resource eventHubNamespaceJson 'Microsoft.EventHub/namespaces@2024-01-01' = {
|
||||
name: baseNameJson
|
||||
location: location
|
||||
sku: {
|
||||
name: 'Standard'
|
||||
tier: 'Standard'
|
||||
capacity: 5
|
||||
}
|
||||
properties: {
|
||||
zoneRedundant: false
|
||||
isAutoInflateEnabled: false
|
||||
maximumThroughputUnits: 0
|
||||
kafkaEnabled: true
|
||||
}
|
||||
}
|
||||
|
||||
resource eventHubNamespaceCustom 'Microsoft.EventHub/namespaces@2024-01-01' = {
|
||||
name: baseNameCustom
|
||||
location: location
|
||||
sku: {
|
||||
name: 'Standard'
|
||||
tier: 'Standard'
|
||||
capacity: 5
|
||||
}
|
||||
properties: {
|
||||
zoneRedundant: false
|
||||
isAutoInflateEnabled: false
|
||||
maximumThroughputUnits: 0
|
||||
kafkaEnabled: true
|
||||
}
|
||||
}
|
||||
|
||||
resource authorizationRuleAvro 'Microsoft.EventHub/namespaces/authorizationRules@2024-01-01' = {
|
||||
name: 'RootManageSharedAccessKey'
|
||||
properties: {
|
||||
rights: [
|
||||
'Listen'
|
||||
'Manage'
|
||||
'Send'
|
||||
]
|
||||
}
|
||||
parent: eventHubNamespaceAvro
|
||||
}
|
||||
|
||||
resource authorizationRuleJson 'Microsoft.EventHub/namespaces/authorizationRules@2024-01-01' = {
|
||||
name: 'RootManageSharedAccessKey'
|
||||
properties: {
|
||||
rights: [
|
||||
'Listen'
|
||||
'Manage'
|
||||
'Send'
|
||||
]
|
||||
}
|
||||
parent: eventHubNamespaceJson
|
||||
}
|
||||
|
||||
resource authorizationRuleCustom 'Microsoft.EventHub/namespaces/authorizationRules@2024-01-01' = {
|
||||
name: 'RootManageSharedAccessKey'
|
||||
properties: {
|
||||
rights: [
|
||||
'Listen'
|
||||
'Manage'
|
||||
'Send'
|
||||
]
|
||||
}
|
||||
parent: eventHubNamespaceCustom
|
||||
}
|
||||
|
||||
resource eventHubsDataOwnerRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
|
||||
name: guid(testApplicationOid, eventHubsDataOwnerRoleId, resourceGroup().id)
|
||||
dependsOn: [
|
||||
eventHubNamespaceAvro
|
||||
eventHubNamespaceJson
|
||||
eventHubNamespaceCustom
|
||||
]
|
||||
properties: {
|
||||
roleDefinitionId: resourceId('Microsoft.Authorization/roleDefinitions', eventHubsDataOwnerRoleId)
|
||||
principalId: testApplicationOid
|
||||
}
|
||||
}
|
||||
|
||||
resource eventHubAvro 'Microsoft.EventHub/namespaces/eventhubs@2024-01-01' = {
|
||||
name: eventHubName
|
||||
properties: {
|
||||
messageRetentionInDays: retentionTimeInDays
|
||||
partitionCount: partitionsCount
|
||||
}
|
||||
parent: eventHubNamespaceAvro
|
||||
}
|
||||
|
||||
resource eventHubJson 'Microsoft.EventHub/namespaces/eventhubs@2024-01-01' = {
|
||||
name: eventHubName
|
||||
properties: {
|
||||
messageRetentionInDays: retentionTimeInDays
|
||||
partitionCount: partitionsCount
|
||||
}
|
||||
parent: eventHubNamespaceJson
|
||||
}
|
||||
|
||||
resource eventHubCustom 'Microsoft.EventHub/namespaces/eventhubs@2024-01-01' = {
|
||||
name: eventHubName
|
||||
properties: {
|
||||
messageRetentionInDays: retentionTimeInDays
|
||||
partitionCount: partitionsCount
|
||||
}
|
||||
parent: eventHubNamespaceCustom
|
||||
}
|
||||
|
||||
resource consumerGroupAvro 'Microsoft.EventHub/namespaces/eventhubs/consumergroups@2024-01-01' = {
|
||||
name: consumerGroupName
|
||||
properties: {}
|
||||
parent: eventHubAvro
|
||||
}
|
||||
|
||||
resource consumerGroupJson 'Microsoft.EventHub/namespaces/eventhubs/consumergroups@2024-01-01' = {
|
||||
name: consumerGroupName
|
||||
properties: {}
|
||||
parent: eventHubJson
|
||||
}
|
||||
|
||||
resource consumerGroupCustom 'Microsoft.EventHub/namespaces/eventhubs/consumergroups@2024-01-01' = {
|
||||
name: consumerGroupName
|
||||
properties: {}
|
||||
parent: eventHubCustom
|
||||
}
|
||||
|
||||
resource schemaGroupAvro 'Microsoft.EventHub/namespaces/schemagroups@2024-01-01' = {
|
||||
name: schemaRegistryGroup
|
||||
properties: {
|
||||
schemaType: 'avro'
|
||||
}
|
||||
parent: eventHubNamespaceAvro
|
||||
}
|
||||
|
||||
resource schemaGroupJson 'Microsoft.EventHub/namespaces/schemagroups@2024-01-01' = {
|
||||
name: schemaRegistryGroup
|
||||
properties: {
|
||||
schemaType: 'json'
|
||||
}
|
||||
parent: eventHubNamespaceJson
|
||||
}
|
||||
|
||||
resource schemaGroupCustom 'Microsoft.EventHub/namespaces/schemagroups@2024-01-01' = {
|
||||
name: schemaRegistryGroup
|
||||
properties: {
|
||||
schemaType: 'custom'
|
||||
}
|
||||
parent: eventHubNamespaceCustom
|
||||
}
|
||||
|
||||
output SCHEMAREGISTRY_AVRO_FULLY_QUALIFIED_NAMESPACE string = eventHubNamespaceAvro.properties.serviceBusEndpoint
|
||||
output SCHEMAREGISTRY_JSON_FULLY_QUALIFIED_NAMESPACE string = eventHubNamespaceJson.properties.serviceBusEndpoint
|
||||
output SCHEMAREGISTRY_CUSTOM_FULLY_QUALIFIED_NAMESPACE string = eventHubNamespaceCustom.properties.serviceBusEndpoint
|
||||
output EVENTHUB_AVRO_HOST_NAME string = replace(replace(eventHubNamespaceAvro.properties.serviceBusEndpoint, ':443/', ''), 'https://', '')
|
||||
output EVENTHUB_JSON_HOST_NAME string = replace(replace(eventHubNamespaceJson.properties.serviceBusEndpoint, ':443/', ''), 'https://', '')
|
||||
output EVENTHUB_CUSTOM_HOST_NAME string = replace(replace(eventHubNamespaceCustom.properties.serviceBusEndpoint, ':443/', ''), 'https://', '')
|
||||
output EVENTHUB_NAME string = eventHubName
|
||||
output SCHEMA_REGISTRY_GROUP string = schemaRegistryGroup
|
|
@ -1,287 +0,0 @@
|
|||
{
|
||||
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"baseName": {
|
||||
"type": "string",
|
||||
"defaultValue": "[resourceGroup().name]",
|
||||
"metadata": {
|
||||
"description": "The base resource name."
|
||||
}
|
||||
},
|
||||
"tenantId": {
|
||||
"type": "string",
|
||||
"defaultValue": "72f988bf-86f1-41af-91ab-2d7cd011db47",
|
||||
"metadata": {
|
||||
"description": "The tenant ID to which the application and resources belong."
|
||||
}
|
||||
},
|
||||
"testApplicationId": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "The application client ID used to run tests."
|
||||
}
|
||||
},
|
||||
"testApplicationOid": {
|
||||
"type": "string",
|
||||
"defaultValue": "b3653439-8136-4cd5-aac3-2a9460871ca6",
|
||||
"metadata": {
|
||||
"description": "The client OID to grant access to test resources."
|
||||
}
|
||||
},
|
||||
"location": {
|
||||
"type": "string",
|
||||
"defaultValue": "[resourceGroup().location]",
|
||||
"metadata": {
|
||||
"description": "The location of the resource. By default, this is the same as the resource group."
|
||||
}
|
||||
},
|
||||
"partitionsCount": {
|
||||
"type": "int",
|
||||
"defaultValue": 4,
|
||||
"metadata": {
|
||||
"description": "Number of partitions in the event hub"
|
||||
}
|
||||
},
|
||||
"retentionTimeInDays": {
|
||||
"type": "int",
|
||||
"defaultValue": 1,
|
||||
"metadata": {
|
||||
"description": "Number of days a message will be retained for in the event hub"
|
||||
}
|
||||
}
|
||||
},
|
||||
"variables": {
|
||||
"apiVersion": "2022-10-01-preview",
|
||||
"baseNameAvro": "[concat(parameters('baseName'), '-avro')]",
|
||||
"baseNameJson": "[concat(parameters('baseName'), '-json')]",
|
||||
"baseNameCustom": "[concat(parameters('baseName'), '-custom')]",
|
||||
"schemaRegistryEndpointAvro": "[format('https://{0}.servicebus.windows.net', variables('baseNameAvro'))]",
|
||||
"schemaRegistryEndpointJson": "[format('https://{0}.servicebus.windows.net', variables('baseNameJson'))]",
|
||||
"schemaRegistryEndpointCustom": "[format('https://{0}.servicebus.windows.net', variables('baseNameCustom'))]",
|
||||
"schemaRegistryGroup": "azsdk_js_test_group",
|
||||
"authorizationNameAvro": "[concat(variables('baseNameAvro'), '/RootManageSharedAccessKey')]",
|
||||
"authorizationNameJson": "[concat(variables('baseNameJson'), '/RootManageSharedAccessKey')]",
|
||||
"authorizationNameCustom": "[concat(variables('baseNameCustom'), '/RootManageSharedAccessKey')]",
|
||||
"eventHubName": "eventhub",
|
||||
"eventHubHostNameAvro": "[format('{0}.servicebus.windows.net', variables('baseNameAvro'))]",
|
||||
"eventHubHostNameJson": "[format('{0}.servicebus.windows.net', variables('baseNameJson'))]",
|
||||
"eventHubHostNameCustom": "[format('{0}.servicebus.windows.net', variables('baseNameCustom'))]",
|
||||
"eventHubNameFullAvro": "[concat(variables('baseNameAvro'), '/eventhub')]",
|
||||
"eventHubNameFullJson": "[concat(variables('baseNameJson'), '/eventhub')]",
|
||||
"eventHubNameFullCustom": "[concat(variables('baseNameCustom'), '/eventhub')]"
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"type": "Microsoft.EventHub/namespaces",
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"name": "[variables('baseNameAvro')]",
|
||||
"location": "[parameters('location')]",
|
||||
"sku": {
|
||||
"name": "Standard",
|
||||
"tier": "Standard",
|
||||
"capacity": 5
|
||||
},
|
||||
"properties": {
|
||||
"zoneRedundant": false,
|
||||
"isAutoInflateEnabled": false,
|
||||
"maximumThroughputUnits": 0,
|
||||
"kafkaEnabled": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.EventHub/namespaces",
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"name": "[variables('baseNameJson')]",
|
||||
"location": "[parameters('location')]",
|
||||
"sku": {
|
||||
"name": "Standard",
|
||||
"tier": "Standard",
|
||||
"capacity": 5
|
||||
},
|
||||
"properties": {
|
||||
"zoneRedundant": false,
|
||||
"isAutoInflateEnabled": false,
|
||||
"maximumThroughputUnits": 0,
|
||||
"kafkaEnabled": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.EventHub/namespaces",
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"name": "[variables('baseNameCustom')]",
|
||||
"location": "[parameters('location')]",
|
||||
"sku": {
|
||||
"name": "Standard",
|
||||
"tier": "Standard",
|
||||
"capacity": 5
|
||||
},
|
||||
"properties": {
|
||||
"zoneRedundant": false,
|
||||
"isAutoInflateEnabled": false,
|
||||
"maximumThroughputUnits": 0,
|
||||
"kafkaEnabled": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.EventHub/namespaces/AuthorizationRules",
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"name": "[variables('authorizationNameAvro')]",
|
||||
"location": "[parameters('location')]",
|
||||
"dependsOn": ["[resourceId('Microsoft.EventHub/namespaces', variables('baseNameAvro'))]"],
|
||||
"properties": {
|
||||
"rights": ["Listen", "Manage", "Send"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.EventHub/namespaces/AuthorizationRules",
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"name": "[variables('authorizationNameJson')]",
|
||||
"location": "[parameters('location')]",
|
||||
"dependsOn": ["[resourceId('Microsoft.EventHub/namespaces', variables('baseNameJson'))]"],
|
||||
"properties": {
|
||||
"rights": ["Listen", "Manage", "Send"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.EventHub/namespaces/AuthorizationRules",
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"name": "[variables('authorizationNameCustom')]",
|
||||
"location": "[parameters('location')]",
|
||||
"dependsOn": ["[resourceId('Microsoft.EventHub/namespaces', variables('baseNameCustom'))]"],
|
||||
"properties": {
|
||||
"rights": ["Listen", "Manage", "Send"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.EventHub/namespaces/eventhubs",
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"name": "[variables('eventHubNameFullAvro')]",
|
||||
"location": "[parameters('location')]",
|
||||
"dependsOn": ["[resourceId('Microsoft.EventHub/namespaces', variables('baseNameAvro'))]"],
|
||||
"properties": {
|
||||
"messageRetentionInDays": "[parameters('retentionTimeInDays')]",
|
||||
"partitionCount": "[parameters('partitionsCount')]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.EventHub/namespaces/eventhubs",
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"name": "[variables('eventHubNameFullJson')]",
|
||||
"location": "[parameters('location')]",
|
||||
"dependsOn": ["[resourceId('Microsoft.EventHub/namespaces', variables('baseNameJson'))]"],
|
||||
"properties": {
|
||||
"messageRetentionInDays": "[parameters('retentionTimeInDays')]",
|
||||
"partitionCount": "[parameters('partitionsCount')]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.EventHub/namespaces/eventhubs",
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"name": "[variables('eventHubNameFullCustom')]",
|
||||
"location": "[parameters('location')]",
|
||||
"dependsOn": ["[resourceId('Microsoft.EventHub/namespaces', variables('baseNameCustom'))]"],
|
||||
"properties": {
|
||||
"messageRetentionInDays": "[parameters('retentionTimeInDays')]",
|
||||
"partitionCount": "[parameters('partitionsCount')]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.EventHub/namespaces/eventhubs/consumergroups",
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"name": "[concat(variables('eventHubNameFullAvro'), '/$Default')]",
|
||||
"location": "[parameters('location')]",
|
||||
"dependsOn": [
|
||||
"[resourceId('Microsoft.EventHub/namespaces/eventhubs', variables('baseNameAvro'), variables('eventHubName'))]",
|
||||
"[resourceId('Microsoft.EventHub/namespaces', variables('baseNameAvro'))]"
|
||||
],
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.EventHub/namespaces/eventhubs/consumergroups",
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"name": "[concat(variables('eventHubNameFullJson'), '/$Default')]",
|
||||
"location": "[parameters('location')]",
|
||||
"dependsOn": [
|
||||
"[resourceId('Microsoft.EventHub/namespaces/eventhubs', variables('baseNameJson'), variables('eventHubName'))]",
|
||||
"[resourceId('Microsoft.EventHub/namespaces', variables('baseNameJson'))]"
|
||||
],
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.EventHub/namespaces/eventhubs/consumergroups",
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"name": "[concat(variables('eventHubNameFullCustom'), '/$Default')]",
|
||||
"location": "[parameters('location')]",
|
||||
"dependsOn": [
|
||||
"[resourceId('Microsoft.EventHub/namespaces/eventhubs', variables('baseNameCustom'), variables('eventHubName'))]",
|
||||
"[resourceId('Microsoft.EventHub/namespaces', variables('baseNameCustom'))]"
|
||||
],
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.EventHub/namespaces/schemagroups",
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"name": "[format('{0}/{1}', variables('baseNameAvro'), variables('schemaRegistryGroup'))]",
|
||||
"location": "[parameters('location')]",
|
||||
"dependsOn": ["[resourceId('Microsoft.EventHub/namespaces', variables('baseNameAvro'))]"],
|
||||
"properties": {
|
||||
"schemaType": "avro"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.EventHub/namespaces/schemagroups",
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"name": "[format('{0}/{1}', variables('baseNameJson'), variables('schemaRegistryGroup'))]",
|
||||
"location": "[parameters('location')]",
|
||||
"dependsOn": ["[resourceId('Microsoft.EventHub/namespaces', variables('baseNameJson'))]"],
|
||||
"properties": {
|
||||
"schemaType": "json"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.EventHub/namespaces/schemagroups",
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"name": "[format('{0}/{1}', variables('baseNameCustom'), variables('schemaRegistryGroup'))]",
|
||||
"location": "[parameters('location')]",
|
||||
"dependsOn": ["[resourceId('Microsoft.EventHub/namespaces', variables('baseNameCustom'))]"],
|
||||
"properties": {
|
||||
"schemaType": "custom"
|
||||
}
|
||||
}
|
||||
],
|
||||
"outputs": {
|
||||
"SCHEMAREGISTRY_AVRO_FULLY_QUALIFIED_NAMESPACE": {
|
||||
"type": "string",
|
||||
"value": "[variables('schemaRegistryEndpointAvro')]"
|
||||
},
|
||||
"SCHEMAREGISTRY_JSON_FULLY_QUALIFIED_NAMESPACE": {
|
||||
"type": "string",
|
||||
"value": "[variables('schemaRegistryEndpointJson')]"
|
||||
},
|
||||
"SCHEMAREGISTRY_CUSTOM_FULLY_QUALIFIED_NAMESPACE": {
|
||||
"type": "string",
|
||||
"value": "[variables('schemaRegistryEndpointCustom')]"
|
||||
},
|
||||
"EVENTHUB_AVRO_HOST_NAME": {
|
||||
"type": "string",
|
||||
"value": "[variables('eventHubHostNameAvro')]"
|
||||
},
|
||||
"EVENTHUB_JSON_HOST_NAME": {
|
||||
"type": "string",
|
||||
"value": "[variables('eventHubHostNameJson')]"
|
||||
},
|
||||
"EVENTHUB_CUSTOM_HOST_NAME": {
|
||||
"type": "string",
|
||||
"value": "[variables('eventHubHostNameCustom')]"
|
||||
},
|
||||
"EVENTHUB_NAME": {
|
||||
"type": "string",
|
||||
"value": "[variables('eventHubName')]"
|
||||
},
|
||||
"SCHEMA_REGISTRY_GROUP": {
|
||||
"type": "string",
|
||||
"value": "[variables('schemaRegistryGroup')]"
|
||||
}
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче