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.web.sites.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,109 @@
@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

@description('Required. The name of the Server Farm to create.')
param serverFarmName string

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

@description('Required. The name of the Application Insights instance to create.')
param applicationInsightsName 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'
}
}
]
}
}

resource privateDNSZone 'Microsoft.Network/privateDnsZones@2020-06-01' = {
name: 'privatelink.azurewebsites.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@2021-09-01' = {
name: storageAccountName
location: location
sku: {
name: 'Standard_LRS'
}
kind: 'StorageV2'
properties: {}
}

resource serverFarm 'Microsoft.Web/serverfarms@2022-03-01' = {
name: serverFarmName
location: location
sku: {
name: 'S1'
tier: 'Standard'
size: 'S1'
family: 'S'
capacity: 1
}
properties: {}
}

resource applicationInsights 'Microsoft.Insights/components@2020-02-02' = {
name: applicationInsightsName
location: location
kind: ''
properties: {}
}

@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 Server Farm.')
output serverFarmResourceId string = serverFarm.id

@description('The resource ID of the created Storage Account.')
output storageAccountResourceId string = storageAccount.id

@description('The resource ID of the created Application Insights instance.')
output applicationInsightsResourceId string = applicationInsights.id

@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,169 @@
targetScope = 'subscription'

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

// =========== //
// 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}'
serverFarmName: 'dep-<<namePrefix>>-sf-${serviceShort}'
storageAccountName: 'dep<<namePrefix>>st${serviceShort}'
applicationInsightsName: 'dep-<<namePrefix>>-appi-${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'
kind: 'functionapp'
serverFarmResourceId: resourceGroupResources.outputs.serverFarmResourceId
appInsightId: resourceGroupResources.outputs.applicationInsightsResourceId
appSettingsKeyValuePairs: {
AzureFunctionsJobHost__logging__logLevel__default: 'Trace'
EASYAUTH_SECRET: 'https://adp-<<namePrefix>>-az-kv-x-001.${environment().suffixes.keyvaultDns}/secrets/Modules-Test-SP-Password'
FUNCTIONS_EXTENSION_VERSION: '~4'
FUNCTIONS_WORKER_RUNTIME: 'dotnet'
}
authSettingV2Configuration: {
globalValidation: {
requireAuthentication: true
unauthenticatedClientAction: 'Return401'
}
httpSettings: {
forwardProxy: {
convention: 'NoProxy'
}
requireHttps: true
routes: {
apiPrefix: '/.auth'
}
}
identityProviders: {
azureActiveDirectory: {
enabled: true
login: {
disableWWWAuthenticate: false
}
registration: {
clientId: 'd874dd2f-2032-4db1-a053-f0ec243685aa'
clientSecretSettingName: 'EASYAUTH_SECRET'
openIdIssuer: 'https://sts.windows.net/${tenant().tenantId}/v2.0/'
}
validation: {
allowedAudiences: [
'api://d874dd2f-2032-4db1-a053-f0ec243685aa'
]
defaultAuthorizationPolicy: {
allowedPrincipals: {}
}
jwtClaimChecks: {}
}
}
}
login: {
allowedExternalRedirectUrls: [
'string'
]
cookieExpiration: {
convention: 'FixedTime'
timeToExpiration: '08:00:00'
}
nonce: {
nonceExpirationInterval: '00:05:00'
validateNonce: true
}
preserveUrlFragmentsForLogins: false
routes: {}
tokenStore: {
azureBlobStorage: {}
enabled: true
fileSystem: {}
tokenRefreshExtensionHours: 72
}
}
platform: {
enabled: true
runtimeVersion: '~1'
}
}
diagnosticLogsRetentionInDays: 7
diagnosticStorageAccountId: diagnosticDependencies.outputs.storageAccountResourceId
diagnosticWorkspaceId: diagnosticDependencies.outputs.logAnalyticsWorkspaceResourceId
diagnosticEventHubAuthorizationRuleId: diagnosticDependencies.outputs.eventHubAuthorizationRuleId
diagnosticEventHubName: diagnosticDependencies.outputs.eventHubNamespaceEventHubName
lock: 'CanNotDelete'
privateEndpoints: [
{
service: 'sites'
subnetResourceId: resourceGroupResources.outputs.subnetResourceId
privateDnsZoneGroup: {
privateDNSResourceIds: [
resourceGroupResources.outputs.privateDNSZoneResourceId
]
}
}
]
roleAssignments: [
{
principalIds: [
resourceGroupResources.outputs.managedIdentityPrincipalId
]
roleDefinitionIdOrName: 'Reader'
}
]
setAzureWebJobsDashboard: true
siteConfig: {
alwaysOn: true
use32BitWorkerProcess: false
}
storageAccountId: resourceGroupResources.outputs.storageAccountResourceId
systemAssignedIdentity: true
userAssignedIdentities: {
'${resourceGroupResources.outputs.managedIdentityResourceId}': {}
}
}
}
20 changes: 0 additions & 20 deletions modules/Microsoft.Web/sites/.test/fa.min.parameters.json

This file was deleted.

Loading