|
| 1 | +// Define the location for the deployment of the components. |
| 2 | +param location string |
| 3 | + |
| 4 | +// Define the name of the storage account that will be created. |
| 5 | +param storageAccountName string |
| 6 | + |
| 7 | +// Define the name of the Azure Functions app service that will be created. |
| 8 | +param appServiceName string |
| 9 | + |
| 10 | +// Define the name of the Azure SQL server instance that will be created. |
| 11 | +param sqlServerName string |
| 12 | + |
| 13 | +// Define the username of the administrator login for the Azure SQL server instance. |
| 14 | +param sqlAdminUserName string |
| 15 | + |
| 16 | +// Define the password of the administrator login for the Azure SQL server instance. |
| 17 | +@secure() |
| 18 | +param sqlAdminPassword string |
| 19 | + |
| 20 | +// Define the Azure Key vault secret name of the administrator login password for the Azure SQL server instance. |
| 21 | +param sqlAdminPassword_secretName string |
| 22 | + |
| 23 | +// Define the name of the Azure SQL database that will be created within the Azure SQL server instance. |
| 24 | +param sqlDatabaseName string |
| 25 | + |
| 26 | +// Define the name of the integration account that will be created. |
| 27 | +param integrationAccountName string |
| 28 | + |
| 29 | +// Define the name of the Key Vault. |
| 30 | +param keyVaultName string |
| 31 | + |
| 32 | +// Define the Service Principal ID that needs access full access to the deployed resource group. |
| 33 | +param servicePrincipal_objectId string |
| 34 | + |
| 35 | +module storageAccount 'br/public:avm/res/storage/storage-account:0.9.1' = { |
| 36 | + name: 'storageAccountDeployment' |
| 37 | + params: { |
| 38 | + name: storageAccountName |
| 39 | + location: location |
| 40 | + allowBlobPublicAccess: true |
| 41 | + publicNetworkAccess: 'Enabled' |
| 42 | + networkAcls: { |
| 43 | + bypass: 'AzureServices' |
| 44 | + defaultAction: 'Allow' |
| 45 | + ipRules: [] |
| 46 | + virtualNetworkRules: [] |
| 47 | + } |
| 48 | + roleAssignments: [ |
| 49 | + { |
| 50 | + principalId: servicePrincipal_objectId |
| 51 | + roleDefinitionIdOrName: 'Storage Blob Data Contributor' |
| 52 | + } |
| 53 | + { |
| 54 | + principalId: servicePrincipal_objectId |
| 55 | + roleDefinitionIdOrName: 'Storage Table Data Contributor' |
| 56 | + } |
| 57 | + ] |
| 58 | + } |
| 59 | +} |
| 60 | + |
| 61 | +module serverfarm 'br/public:avm/res/web/serverfarm:0.2.2' = { |
| 62 | + name: 'serverfarmDeployment' |
| 63 | + params: { |
| 64 | + name: '${appServiceName}-plan' |
| 65 | + skuCapacity: 2 |
| 66 | + skuName: 'Y1' |
| 67 | + location: location |
| 68 | + } |
| 69 | +} |
| 70 | + |
| 71 | +module functionApp 'br/public:avm/res/web/site:0.3.9' = { |
| 72 | + name: 'functionAppDeployment' |
| 73 | + params: { |
| 74 | + kind: 'functionapp' |
| 75 | + name: appServiceName |
| 76 | + serverFarmResourceId: serverfarm.outputs.resourceId |
| 77 | + location: location |
| 78 | + enableTelemetry: false |
| 79 | + siteConfig: { |
| 80 | + alwaysOn: false |
| 81 | + } |
| 82 | + } |
| 83 | +} |
| 84 | + |
| 85 | +module sqlServer 'br/public:avm/res/sql/server:0.4.1' = { |
| 86 | + name: 'sqlServerDeployment' |
| 87 | + params: { |
| 88 | + name: sqlServerName |
| 89 | + location: location |
| 90 | + administratorLogin: sqlAdminUserName |
| 91 | + administratorLoginPassword: sqlAdminPassword |
| 92 | + enableTelemetry: false |
| 93 | + publicNetworkAccess: 'Enabled' |
| 94 | + restrictOutboundNetworkAccess: 'Disabled' |
| 95 | + auditSettings: { |
| 96 | + state: 'Disabled' |
| 97 | + } |
| 98 | + databases: [ |
| 99 | + { |
| 100 | + name: sqlDatabaseName |
| 101 | + skuName: 'Basic' |
| 102 | + skuTier: 'Basic' |
| 103 | + maxSizeBytes: 2147483648 |
| 104 | + } |
| 105 | + ] |
| 106 | + } |
| 107 | +} |
| 108 | + |
| 109 | +resource integrationAccount 'Microsoft.Logic/integrationAccounts@2019-05-01' = { |
| 110 | + name: integrationAccountName |
| 111 | + location: location |
| 112 | + properties: { |
| 113 | + state: 'Enabled' |
| 114 | + } |
| 115 | + sku: { |
| 116 | + name: 'Free' |
| 117 | + } |
| 118 | +} |
| 119 | + |
| 120 | +module vault 'br/public:avm/res/key-vault/vault:0.6.1' = { |
| 121 | + name: 'vaultDeployment' |
| 122 | + params: { |
| 123 | + name: keyVaultName |
| 124 | + location: location |
| 125 | + enableRbacAuthorization: false |
| 126 | + sku: 'standard' |
| 127 | + accessPolicies: [ |
| 128 | + { |
| 129 | + objectId: servicePrincipal_objectId |
| 130 | + permissions: { |
| 131 | + secrets: [ |
| 132 | + 'get', 'list', 'set', 'delete' |
| 133 | + ] |
| 134 | + keys: [ |
| 135 | + 'get', 'list', 'create', 'delete' |
| 136 | + ] |
| 137 | + } |
| 138 | + } |
| 139 | + { |
| 140 | + objectId: '0d926a02-88dc-4279-8265-fbcd8178ecb0' // (built-in) Azure Logic Apps service principal |
| 141 | + permissions: { |
| 142 | + keys: [ |
| 143 | + 'list', 'get', 'decrypt', 'sign' |
| 144 | + ] |
| 145 | + } |
| 146 | + } |
| 147 | + ] |
| 148 | + secrets: [ |
| 149 | + { |
| 150 | + name: sqlAdminPassword_secretName |
| 151 | + value: sqlAdminPassword |
| 152 | + } |
| 153 | + ] |
| 154 | + } |
| 155 | +} |
0 commit comments