|
| 1 | +@description('Specifies the name of the app configuration store.') |
| 2 | +param configStoreName string |
| 3 | + |
| 4 | +@description('Specifies the Azure location where the resources should be created.') |
| 5 | +param location string = resourceGroup().location |
| 6 | + |
| 7 | +@description('Name of the Service Bus namespace where the topic resides that receives the App Configuration events.') |
| 8 | +param serviceBusNamespaceName string |
| 9 | + |
| 10 | +@description('Name of the Service Bus topic that receives the App Configuration events.') |
| 11 | +param serviceBusTopicName string |
| 12 | + |
| 13 | +@description('Name of the Event Grid system topic to register on the App Configuration resource.') |
| 14 | +param systemTopicName string = 'system-topic' |
| 15 | + |
| 16 | +@description('Name of the Event Grid system topic event subscription on the App Configuration resource') |
| 17 | +param systemTopicEventSubscriptionName string = 'system-topic-event-subscription' |
| 18 | + |
| 19 | +@description('Event delivery schema for the Event Grid system topic event subscription on the App Configuration resource') |
| 20 | +@allowed([ |
| 21 | + 'CloudEventSchemaV1_0' |
| 22 | + 'EventGridSchema' |
| 23 | + 'CustomInputSchema' |
| 24 | +]) |
| 25 | +param eventDeliverySchema string = 'CloudEventSchemaV1_0' |
| 26 | + |
| 27 | +resource configStore 'Microsoft.AppConfiguration/configurationStores@2021-10-01-preview' = { |
| 28 | + name: configStoreName |
| 29 | + location: location |
| 30 | + sku: { |
| 31 | + name: 'standard' |
| 32 | + } |
| 33 | +} |
| 34 | + |
| 35 | +resource serviceBusNamespace 'Microsoft.ServiceBus/namespaces@2022-01-01-preview' = { |
| 36 | + name: serviceBusNamespaceName |
| 37 | + location: location |
| 38 | +} |
| 39 | + |
| 40 | +resource topic 'Microsoft.ServiceBus/namespaces/topics@2022-01-01-preview' = { |
| 41 | + name: '${serviceBusNamespace.name}/${serviceBusTopicName}' |
| 42 | +} |
| 43 | + |
| 44 | +resource systemTopic 'Microsoft.EventGrid/systemTopics@2022-06-15' = { |
| 45 | + name: '${configStoreName}-${systemTopicName}' |
| 46 | + location: location |
| 47 | + properties: { |
| 48 | + source: configStore.id |
| 49 | + topicType: 'Microsoft.AppConfiguration.ConfigurationStores' |
| 50 | + } |
| 51 | +} |
| 52 | + |
| 53 | +resource systemTopicEventSubscription 'Microsoft.EventGrid/systemTopics/eventSubscriptions@2021-12-01' = { |
| 54 | + name: '${systemTopic.name}/${systemTopicEventSubscriptionName}' |
| 55 | + properties: { |
| 56 | + destination: { |
| 57 | + properties: { |
| 58 | + resourceId: topic.id |
| 59 | + } |
| 60 | + endpointType: 'ServiceBusTopic' |
| 61 | + } |
| 62 | + filter: { |
| 63 | + includedEventTypes: [ |
| 64 | + 'Microsoft.AppConfiguration.KeyValueModified' |
| 65 | + 'Microsoft.AppConfiguration.KeyValueDeleted' |
| 66 | + ] |
| 67 | + } |
| 68 | + eventDeliverySchema: eventDeliverySchema |
| 69 | + } |
| 70 | +} |
0 commit comments