Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
dcf3b9d
First commit
AlexanderSehr Sep 19, 2022
ac661b2
Merge branch 'main' of https://github.com/Azure/ResourceModules
AlexanderSehr Sep 20, 2022
4809048
Merge branch 'main' of https://github.com/Azure/ResourceModules
AlexanderSehr Sep 20, 2022
3bbc933
Updated EventHub Namespaes to new dependencies approach
AlexanderSehr Sep 20, 2022
e772ac7
Latest troubleshooted version
AlexanderSehr Sep 27, 2022
7d30db6
Small update
AlexanderSehr Sep 27, 2022
83e4133
Merge branch 'main' into users/alsehr/1791_EventHub_namespaces
AlexanderSehr Sep 27, 2022
c30f35f
Update modules/Microsoft.EventHub/namespaces/.test/common/deploy.test…
AlexanderSehr Sep 28, 2022
0f4fff5
Update modules/Microsoft.EventHub/namespaces/.test/pe/deploy.test.bicep
AlexanderSehr Sep 28, 2022
a2829f1
Resolved conflict
AlexanderSehr Oct 3, 2022
167f520
Update modules/Microsoft.EventHub/namespaces/.test/common/deploy.test…
AlexanderSehr Oct 4, 2022
eb1e664
Update modules/Microsoft.EventHub/namespaces/.test/common/deploy.test…
AlexanderSehr Oct 4, 2022
dd45bd5
Update modules/Microsoft.EventHub/namespaces/.test/common/deploy.test…
AlexanderSehr Oct 4, 2022
27931e6
Update modules/Microsoft.EventHub/namespaces/.test/min/deploy.test.bicep
AlexanderSehr Oct 4, 2022
d435662
Update modules/Microsoft.EventHub/namespaces/.test/min/deploy.test.bicep
AlexanderSehr Oct 4, 2022
60aae85
Update modules/Microsoft.EventHub/namespaces/.test/min/deploy.test.bicep
AlexanderSehr Oct 4, 2022
69466a3
Update modules/Microsoft.EventHub/namespaces/.test/pe/deploy.test.bicep
AlexanderSehr Oct 4, 2022
35634a0
Update modules/Microsoft.EventHub/namespaces/.test/pe/deploy.test.bicep
AlexanderSehr Oct 4, 2022
7a9df24
Update modules/Microsoft.EventHub/namespaces/.test/pe/deploy.test.bicep
AlexanderSehr Oct 4, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/ms.eventhub.namespaces.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ jobs:
- name: 'Using test file [${{ matrix.moduleTestFilePaths }}]'
uses: ./.github/actions/templates/validateModuleDeployment
with:
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
parameterFilePath: '${{ env.modulePath }}/${{ matrix.moduleTestFilePaths }}'
templateFilePath: '${{ env.modulePath }}/${{ matrix.moduleTestFilePaths }}'
location: '${{ env.location }}'
resourceGroupName: '${{ env.resourceGroupName }}'
subscriptionId: '${{ secrets.ARM_SUBSCRIPTION_ID }}'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
@description('Optional. The location to deploy to.')
param location string = resourceGroup().location

@description('Required. The name of the Virtual Network to create.')
param virtualNetworkName string

@description('Required. The name of the Managed Identity to create.')
param managedIdentityName string

@description('Required. The name of the Storage Account to create.')
param storageAccountName string

resource virtualNetwork 'Microsoft.Network/virtualNetworks@2022-01-01' = {
name: virtualNetworkName
location: location
properties: {
addressSpace: {
addressPrefixes: [
'10.0.0.0/24'
]
}
subnets: [
{
name: 'defaultSubnet'
properties: {
addressPrefix: '10.0.0.0/24'
serviceEndpoints: [
{
service: 'Microsoft.EventHub'
}
]
}
}
]
}
}

resource privateDNSZone 'Microsoft.Network/privateDnsZones@2020-06-01' = {
name: 'privatelink.servicebus.windows.net'
location: 'global'

resource virtualNetworkLinks 'virtualNetworkLinks@2020-06-01' = {
name: '${virtualNetwork.name}-vnetlink'
location: 'global'
properties: {
virtualNetwork: {
id: virtualNetwork.id
}
registrationEnabled: false
}
}
}

resource managedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2018-11-30' = {
name: managedIdentityName
location: location
}

resource storageAccount 'Microsoft.Storage/storageAccounts@2022-05-01' = {
name: storageAccountName
location: location
sku: {
name: 'Standard_LRS'
}
kind: 'StorageV2'
}

@description('The resource ID of the created Virtual Network Subnet.')
output subnetResourceId string = virtualNetwork.properties.subnets[0].id

@description('The principal ID of the created Managed Identity.')
output managedIdentityPrincipalId string = managedIdentity.properties.principalId

@description('The resource ID of the created Managed Identity.')
output managedIdentityResourceId string = managedIdentity.id

@description('The resource ID of the created Private DNS Zone.')
output privateDNSZoneResourceId string = privateDNSZone.id

@description('The resource ID of the created Storage Account.')
output storageAccountResourceId string = storageAccount.id
175 changes: 175 additions & 0 deletions modules/Microsoft.EventHub/namespaces/.test/common/deploy.test.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
targetScope = 'subscription'

// ========== //
// Parameters //
// ========== //
@description('Optional. The name of the resource group to deploy for testing purposes.')
@maxLength(90)
param resourceGroupName string = 'ms.eventhub.namespaces-${serviceShort}-rg'

@description('Optional. The location to deploy resources to.')
param location string = deployment().location

@description('Optional. A short identifier for the kind of deployment. Should be kept short to not run into resource-name length-constraints.')
param serviceShort string = 'ehncom'

// =========== //
// Deployments //
// =========== //

// General resources
// =================
resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = {
name: resourceGroupName
location: location
}

module resourceGroupResources 'dependencies.bicep' = {
scope: resourceGroup
name: '${uniqueString(deployment().name, location)}-paramNested'
params: {
virtualNetworkName: 'dep-<<namePrefix>>-vnet-${serviceShort}'
managedIdentityName: 'dep-<<namePrefix>>-msi-${serviceShort}'
storageAccountName: 'dep<<namePrefix>>sa${serviceShort}'
}
}

// Diagnostics
// ===========
module diagnosticDependencies '../../../../.shared/dependencyConstructs/diagnostic.dependencies.bicep' = {
scope: resourceGroup
name: '${uniqueString(deployment().name, location)}-diagnosticDependencies'
params: {
storageAccountName: 'dep<<namePrefix>>diasa${serviceShort}01'
logAnalyticsWorkspaceName: 'dep-<<namePrefix>>-law-${serviceShort}'
eventHubNamespaceEventHubName: 'dep-<<namePrefix>>-evh-${serviceShort}'
eventHubNamespaceName: 'dep-<<namePrefix>>-evhns-${serviceShort}'
location: location
}
}

// ============== //
// Test Execution //
// ============== //

module testDeployment '../../deploy.bicep' = {
scope: resourceGroup
name: '${uniqueString(deployment().name)}-test-${serviceShort}'
params: {
name: '<<namePrefix>>${serviceShort}001'

authorizationRules: [
{
name: 'RootManageSharedAccessKey'
rights: [
'Listen'
'Manage'
'Send'
]
}
{
name: 'SendListenAccess'
rights: [
'Listen'
'Send'
]
}
]
diagnosticLogsRetentionInDays: 7
diagnosticStorageAccountId: diagnosticDependencies.outputs.storageAccountResourceId
diagnosticWorkspaceId: diagnosticDependencies.outputs.logAnalyticsWorkspaceResourceId
diagnosticEventHubAuthorizationRuleId: diagnosticDependencies.outputs.eventHubAuthorizationRuleId
diagnosticEventHubName: diagnosticDependencies.outputs.eventHubNamespaceEventHubName
eventHubs: [
{
name: '<<namePrefix>>-az-evh-x-001'
}
{
authorizationRules: [
{
name: 'RootManageSharedAccessKey'
rights: [
'Listen'
'Manage'
'Send'
]
}
{
name: 'SendListenAccess'
rights: [
'Listen'
'Send'
]
}
]
captureDescriptionDestinationArchiveNameFormat: '{Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}'
captureDescriptionDestinationBlobContainer: 'eventhub'
captureDescriptionDestinationName: 'EventHubArchive.AzureBlockBlob'
captureDescriptionDestinationStorageAccountResourceId: resourceGroupResources.outputs.storageAccountResourceId
captureDescriptionEnabled: true
captureDescriptionEncoding: 'Avro'
captureDescriptionIntervalInSeconds: 300
captureDescriptionSizeLimitInBytes: 314572800
captureDescriptionSkipEmptyArchives: true
consumerGroups: [
{
name: 'custom'
userMetadata: 'customMetadata'
}
]
messageRetentionInDays: 1
name: '<<namePrefix>>-az-evh-x-002'
partitionCount: 2
roleAssignments: [
{
principalIds: [
resourceGroupResources.outputs.managedIdentityPrincipalId
]
roleDefinitionIdOrName: 'Reader'
}
]
status: 'Active'
}
]
lock: 'CanNotDelete'
networkRuleSets: {
defaultAction: 'Deny'
ipRules: [
{
action: 'Allow'
ipMask: '10.10.10.10'
}
]
trustedServiceAccessEnabled: false
virtualNetworkRules: [
{
ignoreMissingVnetServiceEndpoint: true
subnetResourceId: resourceGroupResources.outputs.subnetResourceId
}
]
}
privateEndpoints: [
{
privateDnsZoneGroup: {
privateDNSResourceIds: [
resourceGroupResources.outputs.privateDNSZoneResourceId
]
}
service: 'namespace'
subnetResourceId: resourceGroupResources.outputs.subnetResourceId
}
]
roleAssignments: [
{
principalIds: [
resourceGroupResources.outputs.managedIdentityPrincipalId
]
roleDefinitionIdOrName: 'Reader'
}
]
systemAssignedIdentity: true
userAssignedIdentities: {
'${resourceGroupResources.outputs.managedIdentityResourceId}': {}
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
targetScope = 'subscription'

// ========== //
// Parameters //
// ========== //
@description('Optional. The name of the resource group to deploy for testing purposes.')
@maxLength(90)
param resourceGroupName string = 'ms.eventhub.namespaces-${serviceShort}-rg'

@description('Optional. The location to deploy resources to.')
param location string = deployment().location

@description('Optional. A short identifier for the kind of deployment. Should be kept short to not run into resource-name length-constraints.')
param serviceShort string = 'ehnmin'

// =========== //
// Deployments //
// =========== //

// General resources
// =================
resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = {
name: resourceGroupName
location: location
}

// ============== //
// Test Execution //
// ============== //

module testDeployment '../../deploy.bicep' = {
scope: resourceGroup
name: '${uniqueString(deployment().name)}-test-${serviceShort}'
params: {
}
}
Loading