diff --git a/.gitignore b/.gitignore index 65ce944..29ecb70 100644 --- a/.gitignore +++ b/.gitignore @@ -291,4 +291,7 @@ __pycache__/ Properties/PublishProfiles/* Properties/ServiceDependencies/* -*Deploy.json \ No newline at end of file +*Deploy.json + +# Generated ARM templates from Bicep +main.json \ No newline at end of file diff --git a/main.bicep b/main.bicep index 3625799..f60d9e1 100644 --- a/main.bicep +++ b/main.bicep @@ -1,9 +1,10 @@ // main.bicep -// Deploys an Azure App Service Plan and a Web App +// Deploys an Azure App Service Plan, a Web App, and a Storage Account param location string = resourceGroup().location param appServicePlanName string = 'cpu-app20250714124552Plan' param webAppName string = 'test_webapp' +param storageAccountName string = 'cpuapp${uniqueString(resourceGroup().id)}' resource appServicePlan 'Microsoft.Web/serverfarms@2022-03-01' = { name: appServicePlanName @@ -15,12 +16,34 @@ resource appServicePlan 'Microsoft.Web/serverfarms@2022-03-01' = { kind: 'app' } +resource storageAccount 'Microsoft.Storage/storageAccounts@2023-01-01' = { + name: storageAccountName + location: location + sku: { + name: 'Standard_LRS' + } + kind: 'StorageV2' + properties: { + supportsHttpsTrafficOnly: true + minimumTlsVersion: 'TLS1_2' + } +} + resource webApp 'Microsoft.Web/sites@2022-03-01' = { name: webAppName location: location properties: { serverFarmId: appServicePlan.id + siteConfig: { + appSettings: [ + { + name: 'ConnectionStrings__StorageAccount' + value: 'DefaultEndpointsProtocol=https;AccountName=${storageAccount.name};AccountKey=${storageAccount.listKeys().keys[0].value};EndpointSuffix=core.windows.net' + } + ] + } } } output webAppUrl string = 'https://${webApp.name}.azurewebsites.net' +output storageAccountName string = storageAccount.name