wordpress-linux-appservice/ARM_Template_Create_WP/azuredeploy.json

1483 строки
70 KiB
JSON

{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"subscriptionId": {
"type": "string"
},
"name": {
"type": "string"
},
"location": {
"type": "string"
},
"hostingPlanName": {
"type": "string"
},
"serverFarmResourceGroup": {
"type": "string"
},
"ftpsState": {
"type": "string"
},
"autoGeneratedDomainNameLabelScope": {
"type": "string"
},
"sku": {
"type": "string"
},
"skuCode": {
"type": "string"
},
"workerSize": {
"type": "string"
},
"workerSizeId": {
"type": "string"
},
"numberOfWorkers": {
"type": "string"
},
"kind": {
"type": "string"
},
"reserved": {
"type": "bool"
},
"alwaysOn": {
"type": "bool"
},
"linuxFxVersion": {
"type": "string"
},
"dockerRegistryUrl": {
"type": "string"
},
"storageSizeGB": {
"type": "int"
},
"storageIops": {
"type": "int"
},
"storageAutoGrow": {
"type": "string"
},
"storageAutoIoScaling": {
"type": "string"
},
"backupRetentionDays": {
"type": "int"
},
"geoRedundantBackup": {
"type": "string"
},
"charset": {
"type": "string"
},
"collation": {
"type": "string"
},
"vmName": {
"type": "string"
},
"serverEdition": {
"type": "string"
},
"vCores": {
"type": "int"
},
"serverName": {
"type": "string"
},
"serverUsername": {
"type": "string"
},
"serverPassword": {
"type": "securestring"
},
"databaseName": {
"type": "string"
},
"publicNetworkAccess": {
"type": "string"
},
"stagingDatabaseName": {
"type": "string"
},
"wordpressTitle": {
"type": "string"
},
"wordpressAdminEmail": {
"type": "string"
},
"wordpressUsername": {
"type": "string"
},
"wordpressPassword": {
"type": "securestring"
},
"wpLocaleCode": {
"type": "string"
},
"cdnProfileName": {
"type": "string"
},
"cdnEndpointName": {
"type": "string"
},
"cdnType": {
"type": "string"
},
"stagingCdnEndpointName": {
"type": "string"
},
"storageAccountName": {
"type": "string"
},
"storageAccountType": {
"type": "string"
},
"storageAccountKind": {
"type": "string"
},
"storageAccountResourceGroup": {
"type": "string"
},
"accessTier": {
"type": "string"
},
"minimumTlsVersion": {
"type": "string"
},
"supportsHttpsTrafficOnly": {
"type": "bool"
},
"allowBlobPublicAccess": {
"type": "bool"
},
"allowSharedKeyAccess": {
"type": "bool"
},
"allowCrossTenantReplication": {
"type": "bool"
},
"networkAclsBypass": {
"type": "string"
},
"networkAclsDefaultAction": {
"type": "string"
},
"keySource": {
"type": "string"
},
"encryptionEnabled": {
"type": "bool"
},
"infrastructureEncryptionEnabled": {
"type": "bool"
},
"blobContainerName": {
"type": "string"
},
"blobPublicAccessLevel": {
"type": "string"
},
"stagingBlobContainerName": {
"type": "string"
},
"vnetName": {
"type": "string"
},
"subnetForApp": {
"type": "string"
},
"subnetForDb": {
"type": "string"
},
"privateDnsZoneNameForDb": {
"type": "string"
},
"emailDataLocation": {
"type": "string"
},
"emailCommServiceName": {
"type": "string"
},
"commServiceName": {
"type": "string"
},
"managedIdentityName": {
"type": "string"
}
},
"resources": [
{
"apiVersion": "[variables('appServicesApiVersion')]",
"name": "[parameters('name')]",
"type": "Microsoft.Web/sites",
"location": "[parameters('location')]",
"tags": {
"AppProfile": "Wordpress"
},
"dependsOn": [
"[concat('Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]",
"[concat('Microsoft.DBforMySQL/flexibleServers/', parameters('serverName'))]",
"[concat('Microsoft.DBforMySQL/flexibleServers/', parameters('serverName'), '/databases/', parameters('databaseName'))]",
"[concat('Microsoft.ManagedIdentity/userAssignedIdentities/', parameters('managedIdentityName'))]",
"Microsoft.Resources/deployments/serverParameters_aad_auth_only",
"[resourceId('Microsoft.Resources/deployments', 'Storage_Resources')]"
],
"properties": {
"name": "[parameters('name')]",
"siteConfig": {
"appSettings": [
{
"name": "DOCKER_REGISTRY_SERVER_URL",
"value": "[parameters('dockerRegistryUrl')]"
},
{
"name": "WEBSITES_ENABLE_APP_SERVICE_STORAGE",
"value": "true"
},
{
"name": "DATABASE_HOST",
"value": "[concat(parameters('serverName'),'.mysql.database.azure.com')]"
},
{
"name": "DATABASE_NAME",
"value": "[parameters('databaseName')]"
},
{
"name": "WEBSITES_CONTAINER_START_TIME_LIMIT",
"value": "1800"
},
{
"name": "WORDPRESS_LOCALE_CODE",
"value": "[parameters('wpLocaleCode')]"
},
{
"name": "SETUP_PHPMYADMIN",
"value": "true"
},
{
"name": "WORDPRESS_LOCAL_STORAGE_CACHE_ENABLED",
"value": "true"
},
{
"name": "ENTRA_CLIENT_ID",
"value": "[reference(concat('/subscriptions/', parameters('subscriptionId'),'/resourcegroups/', parameters('serverFarmResourceGroup'), '/providers/Microsoft.ManagedIdentity/userAssignedIdentities/', parameters('managedIdentityName')), variables('managedIdentityApiVersion')).clientId]"
},
{
"name": "ENABLE_MYSQL_MANAGED_IDENTITY",
"value": "true"
},
{
"name": "DATABASE_USERNAME",
"value": "[parameters('managedIdentityName')]"
},
{
"name": "CDN_ENABLED",
"value": "true"
},
{
"name": "CDN_ENDPOINT",
"value": "[concat(parameters('cdnEndPointName'),'.azureedge.net')]"
},
{
"name": "BLOB_STORAGE_ENABLED",
"value": "true"
},
{
"name": "STORAGE_ACCOUNT_NAME",
"value": "[parameters('storageAccountName')]"
},
{
"name": "BLOB_CONTAINER_NAME",
"value": "[parameters('blobContainerName')]"
},
{
"name": "STORAGE_ACCOUNT_KEY",
"value": "[listKeys(variables('storageAccountId'), '2019-04-01').keys[0].value]"
},
{
"name": "BLOB_STORAGE_URL",
"value": "[concat(parameters('storageAccountName'),'.blob.core.windows.net')]"
}
],
"connectionStrings": [
{
"name": "WORDPRESS_ADMIN_EMAIL",
"ConnectionString": "[parameters('wordpressAdminEmail')]",
"type": "Custom"
},
{
"name": "WORDPRESS_ADMIN_USER",
"ConnectionString": "[parameters('wordpressUsername')]",
"type": "Custom"
},
{
"name": "WORDPRESS_ADMIN_PASSWORD",
"ConnectionString": "[parameters('wordpressPassword')]",
"type": "Custom"
}
],
"ftpsState": "[parameters('ftpsState')]",
"linuxFxVersion": "[parameters('linuxFxVersion')]"
},
"serverFarmId": "[concat('/subscriptions/', parameters('subscriptionId'),'/resourcegroups/', parameters('serverFarmResourceGroup'), '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]",
"clientAffinityEnabled": false,
"autoGeneratedDomainNameLabelScope": "[parameters('autoGeneratedDomainNameLabelScope')]"
},
"identity": {
"type": "UserAssigned",
"UserAssignedIdentities": {
"[concat('/subscriptions/', parameters('subscriptionId'),'/resourcegroups/', parameters('serverFarmResourceGroup'), '/providers/Microsoft.ManagedIdentity/userAssignedIdentities/', parameters('managedIdentityName'))]": {}
}
}
},
{
"apiVersion": "[variables('appServicesApiVersion')]",
"name": "[parameters('hostingPlanName')]",
"type": "Microsoft.Web/serverfarms",
"location": "[parameters('location')]",
"kind": "[parameters('kind')]",
"tags": {
"AppProfile": "Wordpress"
},
"properties": {
"name": "[parameters('hostingPlanName')]",
"workerSize": "[parameters('workerSize')]",
"workerSizeId": "[parameters('workerSizeId')]",
"numberOfWorkers": "[parameters('numberOfWorkers')]",
"reserved": "[parameters('reserved')]"
},
"sku": {
"Tier": "[parameters('sku')]",
"Name": "[parameters('skuCode')]"
},
"dependsOn": [
"[resourceId('Microsoft.DBforMySQL/flexibleServers', parameters('serverName'))]"
]
},
{
"type": "Microsoft.ManagedIdentity/userAssignedIdentities",
"apiVersion": "[variables('managedIdentityApiVersion')]",
"name": "[parameters('managedIdentityName')]",
"location": "[parameters('location')]",
"properties": {},
"tags": {
"AppProfile": "Wordpress"
}
},
{
"apiVersion": "[variables('databaseApiVersion')]",
"location": "[parameters('location')]",
"name": "[parameters('serverName')]",
"type": "Microsoft.DBforMySQL/flexibleServers/",
"tags": {
"AppProfile": "Wordpress"
},
"properties": {
"version": "[variables('databaseVersion')]",
"administratorLogin": "[parameters('serverUsername')]",
"administratorLoginPassword": "[parameters('serverPassword')]",
"publicNetworkAccess": "[parameters('publicNetworkAccess')]",
"Storage": {
"StorageSizeGB": "[parameters('storageSizeGB')]",
"Iops": "[parameters('storageIops')]",
"Autogrow": "[parameters('storageAutoGrow')]",
"AutoIoScaling": "[parameters('storageAutoIoScaling')]"
},
"Backup": {
"backupRetentionDays": "[parameters('backupRetentionDays')]",
"geoRedundantBackup": "[parameters('geoRedundantBackup')]"
},
"Network": {
"PrivateDnsZoneResourceId": "[resourceId('Microsoft.Network/privateDnsZones', parameters('privateDnsZoneNameForDb'))]",
"DelegatedSubnetResourceId": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('subnetForDb'))]"
}
},
"sku": {
"name": "[parameters('vmName')]",
"tier": "[parameters('serverEdition')]",
"capacity": "[parameters('vCores')]"
},
"dependsOn": [
"[resourceId('Microsoft.Network/privateDnsZones/virtualNetworkLinks', parameters('privateDnsZoneNameForDb'), format('{0}-vnetlink', parameters('privateDnsZoneNameForDb')))]",
"[concat('Microsoft.ManagedIdentity/userAssignedIdentities/', parameters('managedIdentityName'))]",
"[resourceId('Microsoft.Resources/deployments', 'subnet_Resources')]"
],
"identity": {
"type": "UserAssigned",
"UserAssignedIdentities": {
"[concat('/subscriptions/', parameters('subscriptionId'),'/resourcegroups/', parameters('serverFarmResourceGroup'), '/providers/Microsoft.ManagedIdentity/userAssignedIdentities/', parameters('managedIdentityName'))]": {}
}
}
},
{
"type": "Microsoft.DBforMySQL/flexibleServers/databases",
"name": "[format('{0}/{1}', parameters('serverName'), parameters('databaseName') )]",
"apiVersion": "[variables('databaseApiVersion')]",
"properties": {
"charset": "[parameters('charset')]",
"collation": "[parameters('collation')]"
},
"dependsOn": [
"[resourceId('Microsoft.DBforMySQL/flexibleServers', parameters('serverName'))]"
]
},
{
"type": "Microsoft.DBforMySQL/flexibleServers/configurations",
"apiVersion": "[variables('databaseApiVersion')]",
"name": "[format('{0}/{1}', parameters('serverName'), 'sql_generate_invisible_primary_key')]",
"dependsOn": [
"[resourceId('Microsoft.DBforMySQL/flexibleServers', parameters('serverName'))]"
],
"properties": {
"value": "OFF"
}
},
{
"apiVersion": "[variables('resourceDeploymentApiVersion')]",
"type": "Microsoft.Resources/deployments",
"name": "serverParameters_aad_auth_only",
"dependsOn": [
"[resourceId('Microsoft.DBforMySQL/flexibleServers', parameters('serverName'))]",
"Microsoft.Resources/deployments/addAdmins"
],
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.1",
"resources": [
{
"type": "Microsoft.DBforMySQL/flexibleServers/configurations",
"name": "[format('{0}/{1}', parameters('serverName'), 'aad_auth_only')]",
"apiVersion": "[variables('databaseApiVersion')]",
"properties": {
"value": "ON"
}
}
]
}
}
},
{
"apiVersion": "[variables('resourceDeploymentApiVersion')]",
"type": "Microsoft.Resources/deployments",
"name": "addAdmins",
"dependsOn": [
"[resourceId('Microsoft.DBforMySQL/flexibleServers', parameters('serverName'))]"
],
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.1",
"resources": [
{
"type": "Microsoft.DBforMySQL/flexibleServers/administrators",
"name": "[concat(parameters('serverName'),'/ActiveDirectory')]",
"apiVersion": "[variables('databaseApiVersion')]",
"properties": {
"administratorType": "ActiveDirectory",
"login": "[parameters('managedIdentityName')]",
"identityResourceId": "[concat('/subscriptions/', parameters('subscriptionId'),'/resourcegroups/', parameters('serverFarmResourceGroup'), '/providers/Microsoft.ManagedIdentity/userAssignedIdentities/', parameters('managedIdentityName'))]",
"sid": "[reference(concat('/subscriptions/', parameters('subscriptionId'),'/resourcegroups/', parameters('serverFarmResourceGroup'), '/providers/Microsoft.ManagedIdentity/userAssignedIdentities/', parameters('managedIdentityName')), variables('managedIdentityApiVersion')).principalId]",
"tenantId": "[reference(concat('/subscriptions/', parameters('subscriptionId'),'/resourcegroups/', parameters('serverFarmResourceGroup'), '/providers/Microsoft.ManagedIdentity/userAssignedIdentities/', parameters('managedIdentityName')), variables('managedIdentityApiVersion')).tenantId]"
}
}
]
}
}
},
{
"apiVersion": "[variables('resourceDeploymentApiVersion')]",
"type": "Microsoft.Resources/deployments",
"name": "staging_database_deployment",
"dependsOn": [
"[resourceId('Microsoft.DBforMySQL/flexibleServers', parameters('serverName'))]"
],
"properties": {
"mode": "Incremental",
"parameters": {},
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.1",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.DBforMySQL/flexibleServers/databases",
"name": "[format('{0}/{1}', parameters('serverName'), parameters('stagingDatabaseName') )]",
"apiVersion": "[variables('databaseApiVersion')]",
"properties": {
"charset": "[parameters('charset')]",
"collation": "[parameters('collation')]"
}
}
]
}
}
},
{
"type": "Microsoft.Network/virtualNetworks",
"apiVersion": "[variables('vnetDeploymentApiVersion')]",
"location": "[parameters('location')]",
"name": "[parameters('vnetName')]",
"tags": {
"AppProfile": "Wordpress"
},
"properties": {
"addressSpace": {
"addressPrefixes": [
"[variables('vnetAddress')]"
]
},
"subnets": []
},
"dependsOn": []
},
{
"type": "Microsoft.Resources/deployments",
"name": "subnet_Resources",
"apiVersion": "[variables('resourceDeploymentApiVersion')]",
"dependsOn": [
"[resourceId('Microsoft.Network/virtualNetworks/', parameters('vnetName'))]"
],
"resourceGroup": "rajneesh-experiments",
"subscriptionId": "9801ce74-29e4-4846-9d02-5010413d1042",
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.1",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.Network/virtualNetworks/subnets",
"apiVersion": "2021-03-01",
"name": "[format('{0}/{1}', parameters('vnetName'), parameters('subnetForApp'))]",
"properties": {
"addressPrefix": "10.0.0.0/25",
"delegations": [
{
"name": "dlg-appService",
"properties": {
"serviceName": "Microsoft.Web/serverFarms"
}
}
]
}
},
{
"type": "Microsoft.Network/virtualNetworks/subnets",
"apiVersion": "2021-03-01",
"name": "[format('{0}/{1}',parameters('vnetName'), parameters('subnetForDb'))]",
"properties": {
"addressPrefix": "10.0.0.128/25",
"delegations": [
{
"name": "dlg-appService",
"properties": {
"serviceName": "Microsoft.DBforMySQL/flexibleServers"
}
}
]
},
"dependsOn": [
"[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('subnetForApp'))]"
]
}
]
}
}
},
{
"type": "Microsoft.Network/privateDnsZones",
"apiVersion": "[variables('privateDnsApiVersion')]",
"name": "[parameters('privateDnsZoneNameForDb')]",
"location": "global",
"tags": {
"AppProfile": "Wordpress"
},
"resources": [
{
"type": "virtualNetworkLinks",
"apiVersion": "[variables('privateDnsApiVersion')]",
"name": "[format('{0}-vnetlink', parameters('privateDnsZoneNameForDb'))]",
"location": "global",
"dependsOn": [
"[resourceId('Microsoft.Network/privateDnsZones', parameters('privateDnsZoneNameForDb'))]"
],
"properties": {
"virtualNetwork": {
"id": "[resourceId('Microsoft.Network/virtualNetworks/', parameters('vnetName'))]"
},
"registrationEnabled": false
}
}
],
"dependsOn": [
"[resourceId('Microsoft.Network/virtualNetworks/', parameters('vnetName'))]",
"[resourceId('Microsoft.Resources/deployments', 'subnet_Resources')]"
]
},
{
"apiVersion": "[variables('appServicesApiVersion')]",
"type": "Microsoft.Web/sites/networkConfig",
"name": "[format('{0}/{1}', parameters('name'), 'virtualNetwork')]",
"properties": {
"subnetResourceId": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('subnetForApp'))]"
},
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', parameters('name'))]",
"[resourceId('Microsoft.Network/privateDnsZones/virtualNetworkLinks', parameters('privateDnsZoneNameForDb'), format('{0}-vnetlink', parameters('privateDnsZoneNameForDb')))]"
]
},
{
"type": "Microsoft.Web/sites/config",
"apiVersion": "[variables('appServicesApiVersion')]",
"name": "[concat(parameters('name'), '/web')]",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', parameters('name'))]",
"[resourceId('Microsoft.Web/sites/networkConfig', parameters('name'), 'virtualNetwork')]"
],
"properties": {
"alwaysOn": "[parameters('alwaysOn')]"
}
},
{
"type": "Microsoft.Web/sites/slots",
"apiVersion": "[variables('appServicesApiVersion')]",
"name": "[concat(parameters('name'), '/staging')]",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', parameters('name'))]",
"[resourceId('Microsoft.Web/sites/config', parameters('name'), 'web')]",
"[resourceId('Microsoft.Resources/deployments', 'staging_database_deployment')]",
"[resourceId('Microsoft.Web/sites/networkConfig', parameters('name'), 'virtualNetwork')]",
"[resourceId('Microsoft.Communication/CommunicationServices', parameters('commServiceName'))]",
"[resourceId('Microsoft.Resources/deployments', 'staging_blob_storage_deployment')]"
],
"tags": {
"AppProfile": "Wordpress"
},
"kind": "[parameters('kind')]",
"properties": {
"clientAffinityEnabled": false,
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]",
"virtualNetworkSubnetId": "[concat('/subscriptions/', parameters('subscriptionId'),'/resourcegroups/', parameters('serverFarmResourceGroup'), '/providers/Microsoft.Network/virtualNetworks/', parameters('vnetName'), '/subnets/', parameters('subnetForApp'))]",
"siteConfig": {
"appSettings": [
{
"name": "DOCKER_REGISTRY_SERVER_URL",
"value": "[parameters('dockerRegistryUrl')]"
},
{
"name": "WEBSITES_ENABLE_APP_SERVICE_STORAGE",
"value": "true"
},
{
"name": "DATABASE_HOST",
"value": "[concat(parameters('serverName'),'.mysql.database.azure.com')]"
},
{
"name": "DATABASE_NAME",
"value": "[parameters('stagingDatabaseName')]"
},
{
"name": "WEBSITES_CONTAINER_START_TIME_LIMIT",
"value": "1800"
},
{
"name": "WORDPRESS_LOCALE_CODE",
"value": "[parameters('wpLocaleCode')]"
},
{
"name": "SETUP_PHPMYADMIN",
"value": "true"
},
{
"name": "WORDPRESS_LOCAL_STORAGE_CACHE_ENABLED",
"value": "true"
},
{
"name": "ENTRA_CLIENT_ID",
"value": "[reference(concat('/subscriptions/', parameters('subscriptionId'),'/resourcegroups/', parameters('serverFarmResourceGroup'), '/providers/Microsoft.ManagedIdentity/userAssignedIdentities/', parameters('managedIdentityName')), variables('managedIdentityApiVersion')).clientId]"
},
{
"name": "ENABLE_MYSQL_MANAGED_IDENTITY",
"value": "true"
},
{
"name": "DATABASE_USERNAME",
"value": "[parameters('managedIdentityName')]"
},
{
"name": "CDN_ENABLED",
"value": "true"
},
{
"name": "CDN_ENDPOINT",
"value": "[concat(parameters('stagingCdnEndpointName'),'.azureedge.net')]"
},
{
"name": "BLOB_STORAGE_ENABLED",
"value": "true"
},
{
"name": "STORAGE_ACCOUNT_NAME",
"value": "[parameters('storageAccountName')]"
},
{
"name": "BLOB_CONTAINER_NAME",
"value": "[parameters('stagingBlobContainerName')]"
},
{
"name": "STORAGE_ACCOUNT_KEY",
"value": "[listKeys(variables('storageAccountId'), '2019-04-01').keys[0].value]"
},
{
"name": "BLOB_STORAGE_URL",
"value": "[concat(parameters('storageAccountName'),'.blob.core.windows.net')]"
},
{
"name": "WP_EMAIL_CONNECTION_STRING",
"value": "[concat('endpoint=',concat('https://',reference(variables('acsAccountId')).hostName),';senderaddress=',concat( variables('acsSenderEmailAddress'),'@',reference(variables('ecsAccountId')).mailFromSenderDomain))]"
},
{
"name": "ENABLE_EMAIL_MANAGED_IDENTITY",
"value": "true"
}
],
"connectionStrings": [
{
"name": "WORDPRESS_ADMIN_EMAIL",
"ConnectionString": "[parameters('wordpressAdminEmail')]",
"type": "Custom"
},
{
"name": "WORDPRESS_ADMIN_USER",
"ConnectionString": "[parameters('wordpressUsername')]",
"type": "Custom"
},
{
"name": "WORDPRESS_ADMIN_PASSWORD",
"ConnectionString": "[parameters('wordpressPassword')]",
"type": "Custom"
}
],
"ftpsState": "[parameters('ftpsState')]",
"alwaysOn": "[parameters('alwaysOn')]",
"linuxFxVersion": "[parameters('linuxFxVersion')]"
}
},
"identity": {
"type": "UserAssigned",
"UserAssignedIdentities": {
"[concat('/subscriptions/', parameters('subscriptionId'),'/resourcegroups/', parameters('serverFarmResourceGroup'), '/providers/Microsoft.ManagedIdentity/userAssignedIdentities/', parameters('managedIdentityName'))]": {}
}
}
},
{
"type": "Microsoft.Communication/emailServices",
"apiVersion": "[variables('emailApiVersion')]",
"name": "[parameters('emailCommServiceName')]",
"location": "global",
"tags": {
"AppProfile": "Wordpress"
},
"properties": {
"dataLocation": "[parameters('emailDataLocation')]"
}
},
{
"type": "Microsoft.Communication/CommunicationServices",
"apiVersion": "[variables('emailApiVersion')]",
"name": "[parameters('commServiceName')]",
"location": "global",
"tags": {
"AppProfile": "Wordpress"
},
"dependsOn": [
"[resourceId('Microsoft.Communication/emailServices/domains', parameters('emailCommServiceName'), 'AzureManagedDomain')]"
],
"properties": {
"dataLocation": "[parameters('emailDataLocation')]",
"linkedDomains": [
"[resourceId('Microsoft.Communication/emailServices/domains', parameters('emailCommServiceName'), 'AzureManagedDomain')]"
]
}
},
{
"type": "Microsoft.Communication/emailServices/domains",
"apiVersion": "[variables('emailApiVersion')]",
"name": "[concat(parameters('emailCommServiceName'), '/AzureManagedDomain')]",
"location": "global",
"tags": {
"AppProfile": "Wordpress"
},
"dependsOn": [
"[resourceId('Microsoft.Communication/emailServices', parameters('emailCommServiceName'))]"
],
"properties": {
"domainManagement": "AzureManaged",
"userEngagementTracking": "Disabled"
}
},
{
"type": "Microsoft.Authorization/roleAssignments",
"apiVersion": "[variables('rbacAuthApiVersion')]",
"name": "[guid(resourceId('Microsoft.Communication/CommunicationServices', parameters('commServiceName')), parameters('managedIdentityName'), 'Contributor')]",
"scope": "[resourceId('Microsoft.Communication/CommunicationServices', parameters('commServiceName'))]",
"properties": {
"roleDefinitionId": "[concat('/subscriptions/', parameters('subscriptionId'), '/providers/Microsoft.Authorization/roleDefinitions/', 'b24988ac-6180-42a0-ab88-20f7382dd24c')]",
"principalId": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', parameters('managedIdentityName')), variables('managedIdentityApiVersion')).principalId]"
},
"dependsOn": [
"[concat('Microsoft.ManagedIdentity/userAssignedIdentities/', parameters('managedIdentityName'))]",
"[resourceId('Microsoft.Communication/CommunicationServices', parameters('commServiceName'))]"
]
},
{
"apiVersion": "[variables('resourceDeploymentApiVersion')]",
"type": "Microsoft.Resources/deployments",
"name": "appService_Resources",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', parameters('name'))]",
"[resourceId('Microsoft.Communication/CommunicationServices', parameters('commServiceName'))]"
],
"properties": {
"mode": "Incremental",
"parameters": {},
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.1",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.Web/sites/config",
"apiVersion": "[variables('appServicesApiVersion')]",
"name": "[concat(parameters('name'), '/web')]",
"dependsOn": [],
"properties": {
"appSettings": [
{
"name": "DOCKER_REGISTRY_SERVER_URL",
"value": "[parameters('dockerRegistryUrl')]"
},
{
"name": "WEBSITES_ENABLE_APP_SERVICE_STORAGE",
"value": "true"
},
{
"name": "DATABASE_HOST",
"value": "[concat(parameters('serverName'),'.mysql.database.azure.com')]"
},
{
"name": "DATABASE_NAME",
"value": "[parameters('databaseName')]"
},
{
"name": "WEBSITES_CONTAINER_START_TIME_LIMIT",
"value": "1800"
},
{
"name": "WORDPRESS_LOCALE_CODE",
"value": "[parameters('wpLocaleCode')]"
},
{
"name": "SETUP_PHPMYADMIN",
"value": "true"
},
{
"name": "WORDPRESS_LOCAL_STORAGE_CACHE_ENABLED",
"value": "true"
},
{
"name": "ENTRA_CLIENT_ID",
"value": "[reference(concat('/subscriptions/', parameters('subscriptionId'),'/resourcegroups/', parameters('serverFarmResourceGroup'), '/providers/Microsoft.ManagedIdentity/userAssignedIdentities/', parameters('managedIdentityName')), variables('managedIdentityApiVersion')).clientId]"
},
{
"name": "ENABLE_MYSQL_MANAGED_IDENTITY",
"value": "true"
},
{
"name": "DATABASE_USERNAME",
"value": "[parameters('managedIdentityName')]"
},
{
"name": "CDN_ENABLED",
"value": "true"
},
{
"name": "CDN_ENDPOINT",
"value": "[concat(parameters('cdnEndPointName'),'.azureedge.net')]"
},
{
"name": "BLOB_STORAGE_ENABLED",
"value": "true"
},
{
"name": "STORAGE_ACCOUNT_NAME",
"value": "[parameters('storageAccountName')]"
},
{
"name": "BLOB_CONTAINER_NAME",
"value": "[parameters('blobContainerName')]"
},
{
"name": "STORAGE_ACCOUNT_KEY",
"value": "[listKeys(variables('storageAccountId'), '2019-04-01').keys[0].value]"
},
{
"name": "BLOB_STORAGE_URL",
"value": "[concat(parameters('storageAccountName'),'.blob.core.windows.net')]"
},
{
"name": "WP_EMAIL_CONNECTION_STRING",
"value": "[concat('endpoint=',concat('https://',reference(variables('acsAccountId')).hostName),';senderaddress=',concat( variables('acsSenderEmailAddress'),'@',reference(variables('ecsAccountId')).mailFromSenderDomain))]"
},
{
"name": "ENABLE_EMAIL_MANAGED_IDENTITY",
"value": "true"
}
]
}
}
]
}
}
},
{
"apiVersion": "[variables('cdnApiVersion')]",
"type": "Microsoft.Cdn/profiles",
"name": "[parameters('cdnProfileName')]",
"location": "Global",
"sku": {
"name": "[parameters('cdnType')]"
},
"tags": {
"AppProfile": "Wordpress"
},
"properties": {},
"dependsOn": [
"[resourceId('Microsoft.DBforMySQL/flexibleServers', parameters('serverName'))]"
]
},
{
"apiVersion": "[variables('cdnApiVersion')]",
"type": "Microsoft.Cdn/profiles/endpoints",
"name": "[concat(parameters('cdnProfileName'),'/',parameters('cdnEndPointName'))]",
"location": "Global",
"tags": {
"AppProfile": "Wordpress"
},
"properties": {
"isHttpAllowed": true,
"isHttpsAllowed": true,
"isCompressionEnabled": true,
"contentTypesToCompress": [
"application/eot",
"application/font",
"application/font-sfnt",
"application/javascript",
"application/json",
"application/opentype",
"application/otf",
"application/pkcs7-mime",
"application/truetype",
"application/ttf",
"application/vnd.ms-fontobject",
"application/xhtml+xml",
"application/xml",
"application/xml+rss",
"application/x-font-opentype",
"application/x-font-truetype",
"application/x-font-ttf",
"application/x-httpd-cgi",
"application/x-javascript",
"application/x-mpegurl",
"application/x-opentype",
"application/x-otf",
"application/x-perl",
"application/x-ttf",
"font/eot",
"font/ttf",
"font/otf",
"font/opentype",
"image/svg+xml",
"text/css",
"text/csv",
"text/html",
"text/javascript",
"text/js",
"text/plain",
"text/richtext",
"text/tab-separated-values",
"text/xml",
"text/x-script",
"text/x-component",
"text/x-java-source"
],
"origins": [
{
"name": "sample-wordpress-app-hvgxd6frewgccwas-australiacentral-01-azurewebsites-net",
"properties": {
"hostName": "sample-wordpress-app-hvgxd6frewgccwas.australiacentral-01.azurewebsites.net",
"httpPort": 80,
"httpsPort": 443,
"originHostHeader": "sample-wordpress-app-hvgxd6frewgccwas.australiacentral-01.azurewebsites.net",
"priority": 1,
"weight": 1000,
"enabled": true
}
},
{
"name": "sampleword0ab37a5082-blob-core-windows-net",
"properties": {
"hostName": "sampleword0ab37a5082.blob.core.windows.net",
"httpPort": 80,
"httpsPort": 443,
"originHostHeader": "sampleword0ab37a5082.blob.core.windows.net",
"priority": 1,
"weight": 1000,
"enabled": true
}
}
],
"originGroups": [
{
"name": "blob-origin-group",
"properties": {
"origins": [
{
"id": "[resourceId('Microsoft.Cdn/profiles/endpoints/origins', parameters('cdnProfileName'), parameters('cdnEndPointName'), 'sampleword0ab37a5082-blob-core-windows-net')]"
}
]
}
},
{
"name": "app-origin-group",
"properties": {
"origins": [
{
"id": "[resourceId('Microsoft.Cdn/profiles/endpoints/origins', parameters('cdnProfileName'), parameters('cdnEndPointName'), 'sample-wordpress-app-hvgxd6frewgccwas-australiacentral-01-azurewebsites-net')]"
}
]
}
}
],
"defaultOriginGroup": {
"id": "[resourceId('Microsoft.Cdn/profiles/endpoints/originGroups', parameters('cdnProfileName'), parameters('cdnEndPointName'), 'blob-origin-group')]"
},
"geoFilters": [],
"deliveryPolicy": {
"rules": [
{
"name": "originOverrideRule",
"order": 1,
"conditions": [
{
"name": "UrlPath",
"parameters": {
"typeName": "DeliveryRuleUrlPathMatchConditionParameters",
"operator": "BeginsWith",
"negateCondition": true,
"matchValues": [
"[concat(parameters('blobContainerName'), '/wp-content/uploads/')]"
],
"transforms": [
"Lowercase"
]
}
}
],
"actions": [
{
"name": "OriginGroupOverride",
"parameters": {
"typeName": "DeliveryRuleOriginGroupOverrideActionParameters",
"originGroup": {
"id": "[resourceId('Microsoft.Cdn/profiles/endpoints/originGroups', parameters('cdnProfileName'), parameters('cdnEndPointName'), 'app-origin-group')]"
}
}
},
{
"name": "UrlRewrite",
"parameters": {
"typeName": "DeliveryRuleUrlRewriteActionParameters",
"sourcePattern": "[concat('/', parameters('blobContainerName'), '/')]",
"destination": "/",
"preserveUnmatchedPath": true
}
},
{
"name": "ModifyResponseHeader",
"parameters": {
"typeName": "DeliveryRuleHeaderActionParameters",
"headerAction": "Overwrite",
"headerName": "Access-Control-Allow-Origin",
"value": "https://sample-wordpress-app-hvgxd6frewgccwas.australiacentral-01.azurewebsites.net"
}
}
]
}
]
}
},
"dependsOn": [
"[concat('Microsoft.Cdn/profiles/', parameters('cdnProfileName'))]",
"[resourceId('Microsoft.Web/Sites', parameters('name'))]",
"[resourceId('Microsoft.Resources/deployments', 'Storage_Resources')]"
]
},
{
"type": "Microsoft.Resources/deployments",
"name": "staging_cdn_endpoint_deployment",
"apiVersion": "[variables('resourceDeploymentApiVersion')]",
"dependsOn": [
"[concat('Microsoft.Cdn/profiles/', parameters('cdnProfileName'))]",
"[resourceId('Microsoft.Web/Sites', parameters('name'))]",
"[resourceId('Microsoft.Resources/deployments', 'Storage_Resources')]",
"[resourceId('Microsoft.Web/sites/slots', parameters('name'), 'staging')]"
],
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.1",
"parameters": {},
"variables": {},
"resources": [
{
"apiVersion": "[variables('cdnApiVersion')]",
"type": "Microsoft.Cdn/profiles/endpoints",
"name": "[concat(parameters('cdnProfileName'),'/',parameters('stagingCdnEndpointName'))]",
"location": "Global",
"tags": {
"AppProfile": "Wordpress"
},
"properties": {
"isHttpAllowed": true,
"isHttpsAllowed": true,
"isCompressionEnabled": true,
"contentTypesToCompress": [
"application/eot",
"application/font",
"application/font-sfnt",
"application/javascript",
"application/json",
"application/opentype",
"application/otf",
"application/pkcs7-mime",
"application/truetype",
"application/ttf",
"application/vnd.ms-fontobject",
"application/xhtml+xml",
"application/xml",
"application/xml+rss",
"application/x-font-opentype",
"application/x-font-truetype",
"application/x-font-ttf",
"application/x-httpd-cgi",
"application/x-javascript",
"application/x-mpegurl",
"application/x-opentype",
"application/x-otf",
"application/x-perl",
"application/x-ttf",
"font/eot",
"font/ttf",
"font/otf",
"font/opentype",
"image/svg+xml",
"text/css",
"text/csv",
"text/html",
"text/javascript",
"text/js",
"text/plain",
"text/richtext",
"text/tab-separated-values",
"text/xml",
"text/x-script",
"text/x-component",
"text/x-java-source"
],
"origins": [
{
"name": "sample-wordpress-app-staging-g8gbgbgwfvc2fkad-australiacentral-01-azurewebsites-net",
"properties": {
"hostName": "sample-wordpress-app-staging-g8gbgbgwfvc2fkad.australiacentral-01.azurewebsites.net",
"httpPort": 80,
"httpsPort": 443,
"originHostHeader": "sample-wordpress-app-staging-g8gbgbgwfvc2fkad.australiacentral-01.azurewebsites.net",
"priority": 1,
"weight": 1000,
"enabled": true
}
},
{
"name": "sampleword0ab37a5082-blob-core-windows-net",
"properties": {
"hostName": "sampleword0ab37a5082.blob.core.windows.net",
"httpPort": 80,
"httpsPort": 443,
"originHostHeader": "sampleword0ab37a5082.blob.core.windows.net",
"priority": 1,
"weight": 1000,
"enabled": true
}
}
],
"originGroups": [
{
"name": "blob-origin-group",
"properties": {
"origins": [
{
"id": "[resourceId('Microsoft.Cdn/profiles/endpoints/origins', parameters('cdnProfileName'), parameters('stagingCdnEndpointName'), 'sampleword0ab37a5082-blob-core-windows-net')]"
}
]
}
},
{
"name": "app-origin-group",
"properties": {
"origins": [
{
"id": "[resourceId('Microsoft.Cdn/profiles/endpoints/origins', parameters('cdnProfileName'), parameters('stagingCdnEndpointName'), 'sample-wordpress-app-staging-g8gbgbgwfvc2fkad-australiacentral-01-azurewebsites-net')]"
}
]
}
}
],
"defaultOriginGroup": {
"id": "[resourceId('Microsoft.Cdn/profiles/endpoints/originGroups', parameters('cdnProfileName'), parameters('stagingCdnEndpointName'), 'blob-origin-group')]"
},
"geoFilters": [],
"deliveryPolicy": {
"rules": [
{
"name": "originOverrideRule",
"order": 1,
"conditions": [
{
"name": "UrlPath",
"parameters": {
"typeName": "DeliveryRuleUrlPathMatchConditionParameters",
"operator": "BeginsWith",
"negateCondition": true,
"matchValues": [
"[concat(parameters('stagingBlobContainerName'), '/wp-content/uploads/')]"
],
"transforms": [
"Lowercase"
]
}
}
],
"actions": [
{
"name": "OriginGroupOverride",
"parameters": {
"typeName": "DeliveryRuleOriginGroupOverrideActionParameters",
"originGroup": {
"id": "[resourceId('Microsoft.Cdn/profiles/endpoints/originGroups', parameters('cdnProfileName'), parameters('stagingCdnEndpointName'), 'app-origin-group')]"
}
}
},
{
"name": "UrlRewrite",
"parameters": {
"typeName": "DeliveryRuleUrlRewriteActionParameters",
"sourcePattern": "[concat('/', parameters('stagingBlobContainerName'), '/')]",
"destination": "/",
"preserveUnmatchedPath": true
}
},
{
"name": "ModifyResponseHeader",
"parameters": {
"typeName": "DeliveryRuleHeaderActionParameters",
"headerAction": "Overwrite",
"headerName": "Access-Control-Allow-Origin",
"value": "https://sample-wordpress-app-staging-g8gbgbgwfvc2fkad.australiacentral-01.azurewebsites.net"
}
}
]
}
]
}
}
}
]
}
}
},
{
"name": "[parameters('storageAccountName')]",
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "[variables('blobApiVersion')]",
"location": "[parameters('location')]",
"properties": {
"accessTier": "[parameters('accessTier')]",
"minimumTlsVersion": "[parameters('minimumTlsVersion')]",
"supportsHttpsTrafficOnly": "[parameters('supportsHttpsTrafficOnly')]",
"allowBlobPublicAccess": "[parameters('allowBlobPublicAccess')]",
"allowSharedKeyAccess": "[parameters('allowSharedKeyAccess')]",
"allowCrossTenantReplication": "[parameters('allowCrossTenantReplication')]",
"networkAcls": {
"bypass": "[parameters('networkAclsBypass')]",
"defaultAction": "[parameters('networkAclsDefaultAction')]",
"ipRules": []
},
"encryption": {
"keySource": "[parameters('keySource')]",
"services": {
"blob": {
"enabled": "[parameters('encryptionEnabled')]"
},
"file": {
"enabled": "[parameters('encryptionEnabled')]"
},
"table": {
"enabled": "[parameters('encryptionEnabled')]"
},
"queue": {
"enabled": "[parameters('encryptionEnabled')]"
}
},
"requireInfrastructureEncryption": "[parameters('infrastructureEncryptionEnabled')]"
}
},
"dependsOn": [
"[resourceId('Microsoft.DBforMySQL/flexibleServers', parameters('serverName'))]"
],
"kind": "[parameters('storageAccountKind')]",
"tags": {
"AppProfile": "Wordpress"
},
"sku": {
"name": "[parameters('storageAccountType')]"
}
},
{
"type": "Microsoft.Resources/deployments",
"name": "Storage_Resources",
"apiVersion": "[variables('resourceDeploymentApiVersion')]",
"dependsOn": [
"[resourceId('Microsoft.DBforMySQL/flexibleServers', parameters('serverName'))]",
"[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]"
],
"resourceGroup": "rajneesh-experiments",
"subscriptionId": "9801ce74-29e4-4846-9d02-5010413d1042",
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.1",
"parameters": {},
"variables": {},
"resources": [
{
"name": "[concat(parameters('storageAccountName'), '/default')]",
"type": "Microsoft.Storage/storageAccounts/blobServices",
"apiVersion": "[variables('blobApiVersion')]",
"properties": {
"restorePolicy": {
"enabled": false
},
"deleteRetentionPolicy": {
"enabled": true,
"days": 7
},
"containerDeleteRetentionPolicy": {
"enabled": true,
"days": 7
},
"changeFeed": {
"enabled": false
},
"isVersioningEnabled": false
},
"dependsOn": []
},
{
"type": "Microsoft.Storage/storageAccounts/blobServices/containers",
"apiVersion": "[variables('blobApiVersion')]",
"name": "[concat(parameters('storageAccountName'), '/default/', parameters('blobContainerName'))]",
"properties": {
"immutableStorageWithVersioning": {
"enabled": false
},
"metadata": {},
"publicAccess": "[parameters('blobPublicAccessLevel')]"
},
"dependsOn": [
"[resourceId(parameters('storageAccountResourceGroup'),'Microsoft.Storage/storageAccounts/blobServices', parameters('storageAccountName'), 'default')]"
]
}
]
}
}
},
{
"type": "Microsoft.Resources/deployments",
"name": "staging_blob_storage_deployment",
"apiVersion": "[variables('resourceDeploymentApiVersion')]",
"dependsOn": [
"[resourceId('Microsoft.Resources/deployments', 'Storage_Resources')]"
],
"resourceGroup": "rajneesh-experiments",
"subscriptionId": "9801ce74-29e4-4846-9d02-5010413d1042",
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.1",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts/blobServices/containers",
"apiVersion": "[variables('blobApiVersion')]",
"name": "[concat(parameters('storageAccountName'), '/default/', parameters('stagingBlobContainerName'))]",
"properties": {
"immutableStorageWithVersioning": {
"enabled": false
},
"metadata": {},
"publicAccess": "[parameters('blobPublicAccessLevel')]"
}
}
]
}
}
}
],
"variables": {
"appServicesApiVersion": "2021-03-01",
"databaseApiVersion": "2021-12-01-preview",
"databaseVersion": "8.0.21",
"vnetDeploymentApiVersion": "2020-07-01",
"privateDnsApiVersion": "2018-09-01",
"privateEndpointApiVersion": "2021-03-01",
"vnetAddress": "10.0.0.0/23",
"cdnApiVersion": "2020-04-15",
"blobApiVersion": "2021-08-01",
"storageAccountId": "[resourceId(parameters('storageAccountResourceGroup'),'Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]",
"emailApiVersion": "2023-03-31",
"acsAccountId": "[resourceId('Microsoft.Communication/CommunicationServices', parameters('commServiceName'))]",
"ecsAccountId": "[resourceId('Microsoft.Communication/emailServices/domains', parameters('emailCommServiceName'), 'AzureManagedDomain')]",
"acsSenderEmailAddress": "DoNotReply",
"resourceDeploymentApiVersion": "2021-04-01",
"managedIdentityApiVersion": "2018-11-30",
"rbacAuthApiVersion": "2022-04-01"
}
}