Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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.network.frontdoors.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,14 @@
@description('Optional. The location to deploy to.')
param location string = resourceGroup().location

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

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

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

143 changes: 143 additions & 0 deletions modules/Microsoft.Network/frontDoors/.test/common/deploy.test.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
targetScope = 'subscription'

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

// =========== //
// 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: {
managedIdentityName: 'dep-<<namePrefix>>-msi-${serviceShort}'
}
}

// ============== //
// Test Execution //
// ============== //
var resourceName = '<<namePrefix>>${serviceShort}001'
module testDeployment '../../deploy.bicep' = {
scope: resourceGroup
name: '${uniqueString(deployment().name)}-test-${serviceShort}'
params: {
name: resourceName
backendPools: [
{
name: 'backendPool'
properties: {
backends: [
{
address: 'biceptest.local'
backendHostHeader: 'backendAddress'
enabledState: 'Enabled'
httpPort: 80
httpsPort: 443
priority: 1
privateLinkAlias: ''
privateLinkApprovalMessage: ''
privateLinkLocation: ''
privateLinkResourceId: ''
weight: 50
}
]
HealthProbeSettings: {
id: '${resourceGroup.id}/providers/Microsoft.Network/frontDoors/${resourceName}/HealthProbeSettings/heathProbe'
}
LoadBalancingSettings: {
id: '${resourceGroup.id}/providers/Microsoft.Network/frontDoors/${resourceName}/LoadBalancingSettings/loadBalancer'
}
}
}
]
enforceCertificateNameCheck: 'Disabled'
frontendEndpoints: [
{
name: 'frontEnd'
properties: {
hostName: '${resourceName}.azurefd.net'
sessionAffinityEnabledState: 'Disabled'
sessionAffinityTtlSeconds: 60
}
}
]
healthProbeSettings: [
{
name: 'heathProbe'
properties: {
enabledState: ''
healthProbeMethod: ''
intervalInSeconds: 60
path: '/'
protocol: 'Https'
}
}
]
loadBalancingSettings: [
{
name: 'loadBalancer'
properties: {
additionalLatencyMilliseconds: 0
sampleSize: 50
successfulSamplesRequired: 1
}
}
]
lock: 'CanNotDelete'
routingRules: [
{
name: 'routingRule'
properties: {
acceptedProtocols: [
'Http'
'Https'
]
enabledState: 'Enabled'
frontendEndpoints: [
{
id: '${resourceGroup.id}/providers/Microsoft.Network/frontDoors/${resourceName}/FrontendEndpoints/frontEnd'
}
]
patternsToMatch: [
'/*'
]
routeConfiguration: {
'@odata.type': '#Microsoft.Azure.FrontDoor.Models.FrontdoorForwardingConfiguration'
backendPool: {
id: '${resourceGroup.id}/providers/Microsoft.Network/frontDoors/${resourceName}/BackendPools/backendPool'
}
forwardingProtocol: 'MatchRequest'
}
}
}
]
sendRecvTimeoutSeconds: 10
roleAssignments: [
{
principalIds: [
resourceGroupResources.outputs.managedIdentityPrincipalId
]
roleDefinitionIdOrName: 'Reader'
}
]
}
}
116 changes: 116 additions & 0 deletions modules/Microsoft.Network/frontDoors/.test/min/deploy.test.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
targetScope = 'subscription'

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

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

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

// ============== //
// Test Execution //
// ============== //
var resourceName = '<<namePrefix>>${serviceShort}001'
module testDeployment '../../deploy.bicep' = {
scope: resourceGroup
name: '${uniqueString(deployment().name)}-test-${serviceShort}'
params: {
name: resourceName
frontendEndpoints: [
{
name: 'frontEnd'
properties: {
hostName: '${resourceName}.azurefd.net'
sessionAffinityEnabledState: 'Disabled'
sessionAffinityTtlSeconds: 60
}
}
]
healthProbeSettings: [
{
name: 'heathProbe'
properties: {
intervalInSeconds: 60
path: '/'
protocol: 'Https'
}
}
]
loadBalancingSettings: [
{
name: 'loadBalancer'
properties: {
additionalLatencyMilliseconds: 0
sampleSize: 50
successfulSamplesRequired: 1
}
}
]
routingRules: [
{
name: 'routingRule'
properties: {
acceptedProtocols: [
'Https'
]
enabledState: 'Enabled'
frontendEndpoints: [
{
id: '${resourceGroup.id}/providers/Microsoft.Network/frontDoors/${resourceName}/FrontendEndpoints/frontEnd'
}
]
patternsToMatch: [
'/*'
]
routeConfiguration: {
'@odata.type': '#Microsoft.Azure.FrontDoor.Models.FrontdoorForwardingConfiguration'
backendPool: {
id: '${resourceGroup.id}/providers/Microsoft.Network/frontDoors/${resourceName}/BackendPools/backendPool'
}
}
}
}
]
backendPools: [
{
name: 'backendPool'
properties: {
backends: [
{
address: 'biceptest.local'
backendHostHeader: 'backendAddress'
enabledState: 'Enabled'
httpPort: 80
httpsPort: 443
priority: 1
weight: 50
}
]
HealthProbeSettings: {
id: '${resourceGroup.id}/providers/Microsoft.Network/frontDoors/${resourceName}/HealthProbeSettings/heathProbe'
}
LoadBalancingSettings: {
id: '${resourceGroup.id}/providers/Microsoft.Network/frontDoors/${resourceName}/LoadBalancingSettings/loadBalancer'
}
}
}
]
}
}
Loading