Skip to content

Commit

Permalink
Updated module test folders
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderSehr committed Sep 18, 2023
1 parent 773cf9d commit 640939d
Show file tree
Hide file tree
Showing 36 changed files with 1,799 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,22 @@ module nestedDependencies 'dependencies.bicep' = {
cognitiveServiceName: '${namePrefix}${serviceShort}001'
// Adding base time to make the name unique as purge protection must be enabled (but may not be longer than 24 characters total)
keyVaultName: 'dep-${namePrefix}-kv-${serviceShort}-${substring(uniqueString(baseTime), 0, 3)}'
location: location
}
}

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

module testDeployment '../../main.bicep' = {
module testDeployment '../../../main.bicep' = {
scope: resourceGroup
name: '${uniqueString(deployment().name, location)}-test-${serviceShort}'
params: {
enableDefaultTelemetry: enableDefaultTelemetry
name: nestedDependencies.outputs.cognitiveServiceName
kind: 'SpeechServices'
location: location
customerManagedKey: {
keyName: nestedDependencies.outputs.keyVaultKeyName
keyVaultResourceId: nestedDependencies.outputs.keyVaultResourceId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,22 @@ module nestedDependencies 'dependencies.bicep' = {
managedIdentityName: 'dep-${namePrefix}-msi-${serviceShort}'
// Adding base time to make the name unique as purge protection must be enabled (but may not be longer than 24 characters total)
keyVaultName: 'dep-${namePrefix}-kv-${serviceShort}-${substring(uniqueString(baseTime), 0, 3)}'
location: location
}
}

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

module testDeployment '../../main.bicep' = {
module testDeployment '../../../main.bicep' = {
scope: resourceGroup
name: '${uniqueString(deployment().name, location)}-test-${serviceShort}'
params: {
enableDefaultTelemetry: enableDefaultTelemetry
name: '${namePrefix}${serviceShort}001'
kind: 'SpeechServices'
location: location
customerManagedKey: {
keyName: nestedDependencies.outputs.keyVaultKeyName
keyVaultResourceId: nestedDependencies.outputs.keyVaultResourceId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ param resourceGroupName string = 'ms.cognitiveservices.accounts-${serviceShort}-
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 = 'csacom'
param serviceShort string = 'csamax'

@description('Optional. Enable telemetry via a Globally Unique Identifier (GUID).')
param enableDefaultTelemetry bool = true
Expand All @@ -37,12 +37,13 @@ module nestedDependencies 'dependencies.bicep' = {
params: {
virtualNetworkName: 'dep-${namePrefix}-vnet-${serviceShort}'
managedIdentityName: 'dep-${namePrefix}-msi-${serviceShort}'
location: location
}
}

// Diagnostics
// ===========
module diagnosticDependencies '../../../../.shared/.templates/diagnostic.dependencies.bicep' = {
module diagnosticDependencies '../../../../../../utilities/e2e-template-assets/templates/diagnostic.dependencies.bicep' = {
scope: resourceGroup
name: '${uniqueString(deployment().name, location)}-diagnosticDependencies'
params: {
Expand All @@ -58,14 +59,15 @@ module diagnosticDependencies '../../../../.shared/.templates/diagnostic.depende
// Test Execution //
// ============== //

module testDeployment '../../main.bicep' = {
module testDeployment '../../../main.bicep' = {
scope: resourceGroup
name: '${uniqueString(deployment().name, location)}-test-${serviceShort}'
params: {
enableDefaultTelemetry: enableDefaultTelemetry
name: '${namePrefix}${serviceShort}001'
kind: 'Face'
customSubDomainName: '${namePrefix}xdomain'
location: location
diagnosticSettings: [
{
// logAnalyticsDestinationType:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@ resource resourceGroup 'Microsoft.Resources/resourceGroups@2022-09-01' = {
// Test Execution //
// ============== //

module testDeployment '../../main.bicep' = {
module testDeployment '../../../main.bicep' = {
scope: resourceGroup
name: '${uniqueString(deployment().name, location)}-test-${serviceShort}'
params: {
enableDefaultTelemetry: enableDefaultTelemetry
name: '${namePrefix}${serviceShort}001'
kind: 'SpeechServices'
location: location
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,21 @@ module nestedDependencies 'dependencies.bicep' = {
params: {
virtualNetworkName: 'dep-${namePrefix}-vnet-${serviceShort}'
managedIdentityName: 'dep-${namePrefix}-msi-${serviceShort}'
location: location
}
}
// ============== //
// Test Execution //
// ============== //

module testDeployment '../../main.bicep' = {
module testDeployment '../../../main.bicep' = {
scope: resourceGroup
name: '${uniqueString(deployment().name, location)}-test-${serviceShort}'
params: {
enableDefaultTelemetry: enableDefaultTelemetry
name: '${namePrefix}${serviceShort}001'
kind: 'SpeechServices'
location: location
customSubDomainName: '${namePrefix}speechdomain'
privateEndpoints: [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
@description('Optional. The location to deploy resources 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

var addressPrefix = '10.0.0.0/16'

resource virtualNetwork 'Microsoft.Network/virtualNetworks@2023-04-01' = {
name: virtualNetworkName
location: location
properties: {
addressSpace: {
addressPrefixes: [
addressPrefix
]
}
subnets: [
{
name: 'defaultSubnet'
properties: {
addressPrefix: cidrSubnet(addressPrefix, 16, 0)
serviceEndpoints: [
{
service: 'Microsoft.CognitiveServices'
}
]
}
}
]
}
}

resource privateDNSZone 'Microsoft.Network/privateDnsZones@2020-06-01' = {
name: 'privatelink.cognitiveservices.azure.com'
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
}

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

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

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

@description('The resource ID of the created Private DNS zone.')
output privateDNSZoneResourceId string = privateDNSZone.id
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
targetScope = 'subscription'

// ========== //
// Parameters //
// ========== //

@description('Optional. The name of the resource group to deploy for testing purposes.')
@maxLength(90)
param resourceGroupName string = 'ms.cognitiveservices.accounts-${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 = 'csawaf'

@description('Optional. Enable telemetry via a Globally Unique Identifier (GUID).')
param enableDefaultTelemetry bool = true

@description('Optional. A token to inject into the name of each resource.')
param namePrefix string = '[[namePrefix]]'

// ============ //
// Dependencies //
// ============ //

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

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

// Diagnostics
// ===========
module diagnosticDependencies '../../../../../../utilities/e2e-template-assets/templates/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 '../../../main.bicep' = {
scope: resourceGroup
name: '${uniqueString(deployment().name, location)}-test-${serviceShort}'
params: {
enableDefaultTelemetry: enableDefaultTelemetry
name: '${namePrefix}${serviceShort}001'
kind: 'Face'
location: location
customSubDomainName: '${namePrefix}xdomain'
diagnosticSettings: [
{
// logAnalyticsDestinationType:
// marketplacePartnerResourceId:
name: 'customSetting'
metricCategories: [
{
category: 'AllMetrics'
}
]
logCategoriesAndGroups: [
{
category: 'RequestResponse'
}
{
category: 'Audit'
}
]
eventHubName: diagnosticDependencies.outputs.eventHubNamespaceEventHubName
eventHubAuthorizationRuleResourceId: diagnosticDependencies.outputs.eventHubAuthorizationRuleId
storageAccountResourceId: diagnosticDependencies.outputs.storageAccountResourceId
workspaceResourceId: diagnosticDependencies.outputs.logAnalyticsWorkspaceResourceId
}
{
eventHubName: diagnosticDependencies.outputs.eventHubNamespaceEventHubName
eventHubAuthorizationRuleResourceId: diagnosticDependencies.outputs.eventHubAuthorizationRuleId
storageAccountResourceId: diagnosticDependencies.outputs.storageAccountResourceId
workspaceResourceId: diagnosticDependencies.outputs.logAnalyticsWorkspaceResourceId
}
]
lock: 'CanNotDelete'
networkAcls: {
defaultAction: 'Deny'
ipRules: [
{
value: '40.74.28.0/23'
}
]
virtualNetworkRules: [
{
id: nestedDependencies.outputs.subnetResourceId
ignoreMissingVnetServiceEndpoint: false
}
]
}
roleAssignments: [
{
roleDefinitionIdOrName: 'Reader'
principalId: nestedDependencies.outputs.managedIdentityPrincipalId
principalType: 'ServicePrincipal'
}
]
sku: 'S0'
managedIdentities: {
systemAssigned: true
userAssignedResourcesIds: [
nestedDependencies.outputs.managedIdentityResourceId
]
}
privateEndpoints: [
{
privateDnsZoneResourceIds: [
nestedDependencies.outputs.privateDNSZoneResourceId
]
service: 'account'
subnetResourceId: nestedDependencies.outputs.subnetResourceId
tags: {
'hidden-title': 'This is visible in the resource name'
Environment: 'Non-Prod'
Role: 'DeploymentValidation'
}
}
]
tags: {
'hidden-title': 'This is visible in the resource name'
Environment: 'Non-Prod'
Role: 'DeploymentValidation'
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ param resourceGroupName string = 'ms.keyvault.vaults-${serviceShort}-rg'
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 = 'kvvcom'
param serviceShort string = 'kvvmax'

@description('Optional. Enable telemetry via a Globally Unique Identifier (GUID).')
param enableDefaultTelemetry bool = true
Expand All @@ -37,12 +37,13 @@ module nestedDependencies 'dependencies.bicep' = {
params: {
virtualNetworkName: 'dep-${namePrefix}-vnet-${serviceShort}'
managedIdentityName: 'dep-${namePrefix}-msi-${serviceShort}'
location: location
}
}

// Diagnostics
// ===========
module diagnosticDependencies '../../../../.shared/.templates/diagnostic.dependencies.bicep' = {
module diagnosticDependencies '../../../../../../utilities/e2e-template-assets/templates/diagnostic.dependencies.bicep' = {
scope: resourceGroup
name: '${uniqueString(deployment().name, location)}-diagnosticDependencies'
params: {
Expand All @@ -58,12 +59,13 @@ module diagnosticDependencies '../../../../.shared/.templates/diagnostic.depende
// Test Execution //
// ============== //

module testDeployment '../../main.bicep' = {
module testDeployment '../../../main.bicep' = {
scope: resourceGroup
name: '${uniqueString(deployment().name, location)}-test-${serviceShort}'
params: {
enableDefaultTelemetry: enableDefaultTelemetry
name: '${namePrefix}${serviceShort}002'
location: location
accessPolicies: [
{
objectId: nestedDependencies.outputs.managedIdentityPrincipalId
Expand Down
Loading

0 comments on commit 640939d

Please sign in to comment.