diff --git a/appsettings.Development.json b/appsettings.Development.json index 0c208ae..0b5f1ba 100644 --- a/appsettings.Development.json +++ b/appsettings.Development.json @@ -4,5 +4,8 @@ "Default": "Information", "Microsoft.AspNetCore": "Warning" } + }, + "ConnectionStrings": { + "StorageAccount": "UseDevelopmentStorage=true" } } diff --git a/appsettings.json b/appsettings.json index aa5d26a..9c2abe7 100644 --- a/appsettings.json +++ b/appsettings.json @@ -7,6 +7,6 @@ }, "AllowedHosts": "*", "ConnectionStrings": { - "StorageAccount": "" + "StorageAccount": "UseDevelopmentStorage=true" } } diff --git a/main.bicep b/main.bicep index 3625799..c03acee 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, Web App, and 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,11 +16,31 @@ resource appServicePlan 'Microsoft.Web/serverfarms@2022-03-01' = { kind: 'app' } +resource storageAccount 'Microsoft.Storage/storageAccounts@2022-09-01' = { + name: storageAccountName + location: location + sku: { + name: 'Standard_LRS' + } + kind: 'StorageV2' + properties: { + accessTier: 'Hot' + } +} + 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=${environment().suffixes.storage}' + } + ] + } } }