Skip to content

Commit

Permalink
Merge pull request #1193 from solliancenet/mg-t18082-into-0.7.1
Browse files Browse the repository at this point in the history
Refactor of bicep to resolve transient MSI issues in E2E pipeline (cherry-picked from mg-t18082)
  • Loading branch information
ciprianjichici authored Jun 26, 2024
2 parents 3a6225f + 2a3c182 commit 210bef6
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 11 deletions.
6 changes: 6 additions & 0 deletions deploy/quick-start/infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -442,22 +442,28 @@ module configTopic 'shared/config-system-topic.bicep' = {
name: 'configTopic-${timestamp}'
params: {
name: '${abbrs.eventGridDomainsTopics}config${resourceToken}'
eventGridName: eventgrid.outputs.name
destinationTopicName: 'configuration'
location: location
tags: tags
appConfigAccountName: appConfig.outputs.name
}
scope: rg
dependsOn: [eventgrid]
}

module storageTopic 'shared/storage-system-topic.bicep' = {
name: 'storageTopic-${timestamp}'
params: {
name: '${abbrs.eventGridDomainsTopics}storage${resourceToken}'
eventGridName: eventgrid.outputs.name
destinationTopicName: 'storage'
location: location
tags: tags
storageAccountName: storage.outputs.name
}
scope: rg
dependsOn: [eventgrid]
}

module storageSub 'shared/system-topic-subscription.bicep' = {
Expand Down
21 changes: 21 additions & 0 deletions deploy/quick-start/infra/shared/config-system-topic.bicep
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
param name string
param destinationTopicName string
param eventGridName string
param location string = resourceGroup().location
param tags object = {}
param appConfigAccountName string
Expand All @@ -7,6 +9,25 @@ resource appConfig 'Microsoft.AppConfiguration/configurationStores@2023-08-01-pr
name: appConfigAccountName
}

resource eventGridNamespace 'Microsoft.EventGrid/namespaces@2023-12-15-preview' existing = {
name: eventGridName
}

resource destinationTopic 'Microsoft.EventGrid/namespaces/topics@2023-12-15-preview' existing = {
name: destinationTopicName
parent: eventGridNamespace
}

resource eventSendRole 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
scope: destinationTopic
name: guid(subscription().id, resourceGroup().id, topic.id, 'sendEventRole')
properties: {
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'd5a91429-5739-47e2-a06b-3470a27159e7')
principalType: 'ServicePrincipal'
principalId: topic.identity.principalId
}
}

resource topic 'Microsoft.EventGrid/systemTopics@2023-12-15-preview' = {
name: name
location: location
Expand Down
21 changes: 21 additions & 0 deletions deploy/quick-start/infra/shared/storage-system-topic.bicep
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
param name string
param destinationTopicName string
param eventGridName string
param location string = resourceGroup().location
param tags object = {}
param storageAccountName string
Expand All @@ -7,6 +9,25 @@ resource storage 'Microsoft.Storage/storageAccounts@2023-01-01' existing = {
name: storageAccountName
}

resource eventGridNamespace 'Microsoft.EventGrid/namespaces@2023-12-15-preview' existing = {
name: eventGridName
}

resource destinationTopic 'Microsoft.EventGrid/namespaces/topics@2023-12-15-preview' existing = {
name: destinationTopicName
parent: eventGridNamespace
}

resource eventSendRole 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
scope: destinationTopic
name: guid(subscription().id, resourceGroup().id, topic.id, 'sendEventRole')
properties: {
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'd5a91429-5739-47e2-a06b-3470a27159e7')
principalType: 'ServicePrincipal'
principalId: topic.identity.principalId
}
}

resource topic 'Microsoft.EventGrid/systemTopics@2023-12-15-preview' = {
name: name
location: location
Expand Down
11 changes: 0 additions & 11 deletions deploy/quick-start/infra/shared/system-topic-subscription.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,6 @@ resource topic 'Microsoft.EventGrid/systemTopics@2023-12-15-preview' existing =
name: topicName
}

resource eventSendRole 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
scope: destinationTopic
name: guid(subscription().id, resourceGroup().id, topic.id, 'sendEventRole')
properties: {
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'd5a91429-5739-47e2-a06b-3470a27159e7')
principalType: 'ServicePrincipal'
principalId: topic.identity.principalId
}
}

resource resourceProviderSub 'Microsoft.EventGrid/systemTopics/eventSubscriptions@2023-12-15-preview' = {
name: name
parent: topic
Expand Down Expand Up @@ -56,5 +46,4 @@ resource resourceProviderSub 'Microsoft.EventGrid/systemTopics/eventSubscription
eventTimeToLiveInMinutes: 1440
}
}
dependsOn: [ eventSendRole ]
}

0 comments on commit 210bef6

Please sign in to comment.