Last active
March 21, 2021 15:01
-
-
Save sjkp/e5ab33051e5a2c9eb85c524639838188 to your computer and use it in GitHub Desktop.
Bicep template for requesting app service certificates
This file contains hidden or 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
param domainNames array | |
param appServicePlanName string | |
param location string = resourceGroup().location | |
resource certificates 'Microsoft.Web/certificates@2020-06-01' = [for domainName in domainNames: { | |
name: domainName | |
location: location | |
properties: { | |
canonicalName: domainName | |
serverFarmId: resourceId('Microsoft.Web/serverfarms', appServicePlanName) | |
domainValidationMethod: 'http-token' | |
} | |
}] | |
//output thumbprint1 object = certificates[0] | |
//output thumbprint2 object = certificates[1] | |
output thumbprints array = [for i in range(0,length(domainNames)): certificates[i]] |
This file contains hidden or 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
targetScope = 'subscription' | |
param domainNames array | |
param appServicePlanName string | |
param appServicePlanResourceGroupName string | |
param appName string | |
param appResourceGroupName string | |
module certificate './certificate.bicep' = { | |
name: 'certificate' | |
scope: resourceGroup(appServicePlanResourceGroupName) | |
params: { | |
appServicePlanName: appServicePlanName | |
domainNames: domainNames | |
} | |
} | |
// var certs = [ | |
// certificate.outputs.thumbprint1 | |
// certificate.outputs.thumbprint2 | |
// ] | |
module sslbindings './sslbindings.bicep' = { | |
name: 'sslbindings' | |
scope: resourceGroup(appResourceGroupName) | |
params: { | |
appName: appName | |
certificates: certificate.outputs.thumbprints | |
} | |
} |
This file contains hidden or 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
param certificates array | |
param appName string | |
param location string = resourceGroup().location | |
resource hostNameSsl 'Microsoft.Web/sites@2020-06-01' = { | |
name: appName | |
location: location | |
properties: { | |
hostNameSslStates: [for certificate in certificates: { | |
name: certificate.properties.canonicalName | |
sslState: 'SniEnabled' | |
thumbprint: certificate.properties.thumbprint | |
toUpdate: true | |
}] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment