forked from Azure/bicep-registry-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
773cf9d
commit 640939d
Showing
36 changed files
with
1,799 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
avm/res/cognitive-services/account/tests/e2e/waf-aligned/dependencies.bicep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
150 changes: 150 additions & 0 deletions
150
avm/res/cognitive-services/account/tests/e2e/waf-aligned/main.test.bicep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | ||
} | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.