Skip to content

Commit f486f6e

Browse files
authored
Merge pull request #83 from delegateas/features/controllable-app-service-naming-in-bicep
Optional app service name override
2 parents 96a0ca4 + 3995bc1 commit f486f6e

File tree

5 files changed

+18
-5
lines changed

5 files changed

+18
-5
lines changed

Infrastructure/main.bicep

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ param websitePassword string
44
@secure()
55
param sessionSecret string
66

7+
@description('Custom name for the App Service. If not provided, defaults to wa-{solutionId}')
8+
param appServiceName string = ''
9+
710
param adoOrganizationUrl string = ''
811
param adoProjectName string = ''
912
param adoRepositoryName string = ''
@@ -28,6 +31,7 @@ param entraIdAllowedGroups string = ''
2831
param disablePasswordAuth bool = false
2932

3033
var location = resourceGroup().location
34+
var resolvedAppServiceName = empty(appServiceName) ? 'wa-${solutionId}' : appServiceName
3135

3236
@description('Create an App Service Plan')
3337
resource appServicePlan 'Microsoft.Web/serverfarms@2021-02-01' = {
@@ -44,7 +48,7 @@ resource appServicePlan 'Microsoft.Web/serverfarms@2021-02-01' = {
4448

4549
@description('Create a Web App')
4650
resource webApp 'Microsoft.Web/sites@2021-02-01' = {
47-
name: 'wa-${solutionId}'
51+
name: resolvedAppServiceName
4852
location: location
4953
identity: {
5054
type: 'SystemAssigned'
@@ -70,7 +74,7 @@ resource webApp 'Microsoft.Web/sites@2021-02-01' = {
7074
}
7175
{
7276
name: 'NEXTAUTH_URL'
73-
value: 'https://wa-${solutionId}.azurewebsites.net'
77+
value: 'https://${resolvedAppServiceName}.azurewebsites.net'
7478
}
7579
{
7680
name: 'WEBSITE_NODE_DEFAULT_VERSION'
@@ -119,5 +123,6 @@ resource webApp 'Microsoft.Web/sites@2021-02-01' = {
119123

120124
@description('Output the web app name and managed identity info')
121125
output webAppName string = webApp.name
126+
output webAppUrl string = 'https://${webApp.properties.defaultHostName}'
122127
output managedIdentityPrincipalId string = webApp.identity.principalId
123128
output managedIdentityClientId string = webApp.identity.tenantId

Setup/azure-pipelines-deploy-jobs.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ parameters:
2323
- name: websiteName
2424
type: string
2525
default: ''
26+
- name: appServiceName
27+
type: string
28+
default: ''
2629
- name: adoOrganizationUrl
2730
type: string
2831
default: ''
@@ -69,6 +72,7 @@ steps:
6972
--parameters websitePassword="${{ parameters.websitePassword }}" `
7073
--parameters sessionSecret="${{ parameters.websiteSessionSecret }}" `
7174
--parameters solutionId="${{ parameters.websiteName }}" `
75+
--parameters appServiceName="${{ parameters.appServiceName }}" `
7276
--parameters adoOrganizationUrl="${{ parameters.adoOrganizationUrl }}" `
7377
--parameters adoProjectName="${{ parameters.adoProjectName }}" `
7478
--parameters adoRepositoryName="${{ parameters.adoRepositoryName }}" `

Setup/azure-pipelines-external.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
# - EnableEntraIdAuth (string: 'true' or 'false', default: 'false')
2929
# - DisablePasswordAuth (string: 'true' or 'false', default: 'false')
3030
# - EntraIdAllowedGroups (comma-separated list of Entra ID group object IDs)
31+
#
32+
# Optional variables (for custom naming):
33+
# - AppServiceName (custom App Service name, defaults to wa-{WebsiteName} if not provided)
3134

3235
trigger: none
3336
pr: none
@@ -97,6 +100,7 @@ stages:
97100
websitePassword: $(WebsitePassword)
98101
websiteSessionSecret: $(WebsiteSessionSecret)
99102
websiteName: $(WebsiteName)
103+
appServiceName: ${{ coalesce(variables.AppServiceName, '') }}
100104
adoOrganizationUrl: $(System.CollectionUri)
101105
adoProjectName: $(System.TeamProject)
102106
adoRepositoryName: ${{ coalesce(variables.AdoRepositoryName, '') }}

Website/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Website/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "website",
3-
"version": "2.3.1",
3+
"version": "2.3.3",
44
"private": true,
55
"scripts": {
66
"dev": "next dev",

0 commit comments

Comments
 (0)