Update deployment without deployment script

This commit is contained in:
Pieter Vanhove
2021-05-04 09:24:34 +02:00
committed by GitHub
parent cf4deeb519
commit cae5594a28
@@ -117,30 +117,6 @@ resource AssignAttestationReader_Resource 'Microsoft.Authorization/roleAssignmen
// Configure the web application // // Configure the web application //
/////////////////////////////////// ///////////////////////////////////
// Create a managed identity for the web app deployment
resource ManagedIdentity_Resource 'Microsoft.ManagedIdentity/userAssignedIdentities@2018-11-30' = {
name: '${projectName}identity'
tags: {}
location: location
}
var uamiId = resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', '${ManagedIdentity_Resource.name}')
//Add the Managed Identity to the Contributor Role
resource AssignContributor_Resource 'Microsoft.Authorization/roleAssignments@2020-04-01-preview' = {
//name: guid(resourceGroup().id,currentTime)
name: guid(uniqueString(resourceGroup().id),dateTimeAdd(currentTime,'PT1S'))
scope: any(resourceGroup().id)
properties: {
roleDefinitionId: '/subscriptions/${subscription().subscriptionId}/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c'
principalId: ManagedIdentity_Resource.properties.principalId
principalType: 'ServicePrincipal'
}
dependsOn: [
ManagedIdentity_Resource
]
}
// Create an App Service plan in Free tier // Create an App Service plan in Free tier
resource WebAppServicePlan_Resource 'Microsoft.Web/serverfarms@2020-09-01' = { resource WebAppServicePlan_Resource 'Microsoft.Web/serverfarms@2020-09-01' = {
name: '${projectName}plan' name: '${projectName}plan'
@@ -162,6 +138,9 @@ resource WebApp_Resource 'Microsoft.Web/sites@2020-09-01' = {
properties: { properties: {
serverFarmId: WebAppServicePlan_Resource.id serverFarmId: WebAppServicePlan_Resource.id
} }
dependsOn: [
WebAppServicePlan_Resource
]
} }
// Set the database connection string for the application // Set the database connection string for the application
@@ -173,28 +152,25 @@ resource WebAppConnectionString_Resource 'Microsoft.Web/sites/config@2020-09-01'
type: 'SQLAzure' type: 'SQLAzure'
} }
} }
dependsOn: [
WebApp_Resource
]
} }
// Deploy the application // Deploy the application
resource DeployWebApp 'Microsoft.Resources/deploymentScripts@2020-10-01' = { resource siteName_web 'Microsoft.Web/sites/sourcecontrols@2015-04-01' = {
name: '${projectName}script' name: '${WebApp_Resource.name}/web'
location: location properties: {
identity: { RepoUrl: 'https://github.com/Pietervanhove/AEDemo.git'
type: 'UserAssigned' branch: 'master'
userAssignedIdentities: { IsManualIntegration: true
'${uamiId}': {}
}
}
kind: 'AzurePowerShell'
properties: {
azPowerShellVersion: '5.0'
scriptContent: '$PropertiesObject = @{repoUrl = "https://github.com/Pietervanhove/AEDemo.git"; branch = "master"; isManualIntegration = "true";} \r\n Set-AzResource -Properties $PropertiesObject -ResourceGroupName ${resourceGroup().name} -ResourceType Microsoft.Web/sites/sourcecontrols -ResourceName ${WebApp_Resource.name}/web -ApiVersion 2015-08-01 -Force'
cleanupPreference: 'OnSuccess'
retentionInterval: 'P1D'
forceUpdateTag: currentTime // ensures script will run every time
} }
dependsOn: [
WebApp_Resource
]
} }
////////////////////////////////////// //////////////////////////////////////
// Create and configure a key vault // // Create and configure a key vault //
////////////////////////////////////// //////////////////////////////////////