-
Notifications
You must be signed in to change notification settings - Fork 264
Description
- [X ] Make sure you've installed the latest version using instructions in the wiki
Output from azd version
azd version 0.8.0-beta.2 (commit 429b6cc)
Describe the bug
ERROR: deployment failed: error deploying infrastructure: deploying to subscription:
Deployment Error Details:
InvalidTemplate: Deployment template validation failed: 'The template resource '' of type 'Microsoft.Storage/storageAccounts' at line '1' and column '671' is not valid. The name property cannot be null or empty. Please see https://aka.ms/arm-syntax-resources for usage details.'.
To Reproduce
created a storage bicep account
Expected behavior
To deploy a storage account with a container called staging
Environment
vs Code
Additional context
Bicep File:
param storageAccountNameData string ='glypheditordata'
param location string
param tags object = {}
param corsRules array = []
resource storageAccountData 'Microsoft.Storage/storageAccounts@2022-05-01' = {
name: storageAccountNameData
location: location
sku: {
name: 'Standard_RAGRS'
}
kind: 'StorageV2'
tags: tags
properties: {
accessTier: 'Hot'
dnsEndpointType: 'Standard'
defaultToOAuthAuthentication: false
publicNetworkAccess: 'Enabled'
allowCrossTenantReplication: true
minimumTlsVersion: 'TLS1_2'
allowBlobPublicAccess: true
allowSharedKeyAccess: true
networkAcls: {
bypass: 'AzureServices'
virtualNetworkRules: []
ipRules: []
defaultAction: 'Allow'
}
supportsHttpsTrafficOnly: true
encryption: {
requireInfrastructureEncryption: false
services: {
blob: {
keyType: 'Account'
enabled: true
}
}
keySource: 'Microsoft.Storage'
}
}
}
resource storageAccountDefaults 'Microsoft.Storage/storageAccounts/blobServices@2022-05-01' = {
parent: storageAccountData
name: 'default'
properties: {
changeFeed: {
enabled: false
}
restorePolicy: {
enabled: false
}
cors: {
corsRules: corsRules
}
deleteRetentionPolicy: {
allowPermanentDelete: false
enabled: true
days: 7
}
containerDeleteRetentionPolicy: {
enabled: true
days: 7
}
isVersioningEnabled: false
}
}
resource storageAccounts_container 'Microsoft.Storage/storageAccounts/blobServices/containers@2022-05-01' = {
parent: storageAccountDefaults
name: 'staging'
properties: {
immutableStorageWithVersioning: {
enabled: false
}
defaultEncryptionScope: '$account-encryption-key'
denyEncryptionScopeOverride: false
publicAccess: 'None'
}
}
output storageAccountName string = storageAccountData.name
output StorageAccountId string = storageAccountData.id
Main.bicep
targetScope = 'subscription'
@minlength(1)
@maxlength(64)
@description('Name of the the environment which is used to generate a short unique hash used in all resources.')
param environmentName string
@minlength(1)
@description('Primary location for all resources')
param location string
param apiServiceName string = ''
param applicationInsightsDashboardName string = ''
param applicationInsightsName string = ''
param containerAppsEnvironmentName string = ''
param containerRegistryName string = ''
param logAnalyticsName string = ''
param resourceGroupName string = ''
param webContainerAppName string = ''
param databaseServerName string = ''
param appServicePlanName string = ''
param storageAccountNameData string=''
@description('The image name for the web service')
param webImageName string = ''
@secure()
param databaseUsername string
@secure()
param databasePassword string
var abbrs = loadJsonContent('./abbreviations.json')
var resourceToken = toLower(uniqueString(subscription().id, environmentName, location))
var tags = { 'azd-env-name': environmentName }
// Organize resources in a resource group
resource rg 'Microsoft.Resources/resourceGroups@2021-04-01' = {
name: !empty(resourceGroupName) ? resourceGroupName : '${abbrs.resourcesResourceGroups}${environmentName}'
location: location
tags: tags
}
// Monitor application with Azure Monitor
module monitoring './core/monitor/monitoring.bicep' = {
name: 'monitoring'
scope: rg
params: {
location: location
tags: tags
logAnalyticsName: !empty(logAnalyticsName) ? logAnalyticsName : '${abbrs.operationalInsightsWorkspaces}${resourceToken}'
applicationInsightsName: !empty(applicationInsightsName) ? applicationInsightsName : '${abbrs.insightsComponents}${resourceToken}'
dashboardName: !empty(applicationInsightsDashboardName) ? applicationInsightsDashboardName : '${abbrs.portalDashboards}${resourceToken}'
}
}
// Container apps host (including container registry)
module containerApps './core/host/container-apps.bicep' = {
name: 'container-apps'
scope: rg
params: {
name: 'app'
containerAppsEnvironmentName: !empty(containerAppsEnvironmentName) ? containerAppsEnvironmentName : '${abbrs.appManagedEnvironments}${resourceToken}'
containerRegistryName: !empty(containerRegistryName) ? containerRegistryName : '${abbrs.containerRegistryRegistries}${resourceToken}'
location: location
logAnalyticsWorkspaceName: monitoring.outputs.logAnalyticsWorkspaceName
}
}
// Web frontend
module web './app/web.bicep' = {
name: 'web'
scope: rg
params: {
name: !empty(webContainerAppName) ? webContainerAppName : '${abbrs.appContainerApps}web-${resourceToken}'
location: location
imageName: webImageName
applicationInsightsName: monitoring.outputs.applicationInsightsName
containerAppsEnvironmentName: containerApps.outputs.environmentName
containerRegistryName: containerApps.outputs.registryName
}
}
// Create an App Service Plan to group applications under the same payment plan and SKU
module appServicePlan './core/host/appserviceplan.bicep' = {
name: 'appserviceplan'
scope: rg
params: {
name: !empty(appServicePlanName) ? appServicePlanName : '${abbrs.webServerFarms}${resourceToken}'
location: location
tags: tags
sku: {
name: 'B1'
}
}
}
// // The application backend
module api './app/api.bicep' = {
name: 'api'
scope: rg
params: {
name: !empty(apiServiceName) ? apiServiceName : '${abbrs.webSitesAppService}api-${resourceToken}'
location: location
tags: tags
applicationInsightsName: monitoring.outputs.applicationInsightsName
appServicePlanId: appServicePlan.outputs.id
keyVaultName: ''
appSettings: {
ASPNETCORE_ENVIRONMENT: 'Staging'
}
}
}
// Postgres setup
module postgres './app/db.bicep' = {
name: 'postgres'
scope: rg
params: {
administratorLogin: databaseUsername
administratorLoginPassword: databasePassword
location: location
serverName: !empty(databaseServerName) ? databaseServerName : '${abbrs.dBforPostgreSQLServers}db-${resourceToken}'
}
}
// Storage setup
module storageData './core/storage/storage-data.bicep'={
name: 'storageData'
scope: rg
params:{
storageAccountNameData: storageAccountNameData
location: location
tags: tags
}
}
// App outputs
output APPLICATIONINSIGHTS_CONNECTION_STRING string = monitoring.outputs.applicationInsightsConnectionString
output APPLICATIONINSIGHTS_NAME string = monitoring.outputs.applicationInsightsName
output AZURE_CONTAINER_ENVIRONMENT_NAME string = containerApps.outputs.environmentName
output AZURE_CONTAINER_REGISTRY_ENDPOINT string = containerApps.outputs.registryLoginServer
output AZURE_CONTAINER_REGISTRY_NAME string = containerApps.outputs.registryName
output AZURE_LOCATION string = location
output AZURE_TENANT_ID string = tenant().tenantId
output REACT_APP_WEB_BASE_URL string = web.outputs.SERVICE_WEB_URI
output SERVICE_API_NAME string = api.outputs.SERVICE_API_NAME
output SERVICE_WEB_NAME string = web.outputs.SERVICE_WEB_NAME
output AZURE_DATABASE_SERVER_NAME string = postgres.outputs.SERVER_NAME
output AZURE_DATABASE_SERVER_HOST string = postgres.outputs.SERVER_HOST
output AZURE_DATABASE_NAME string = postgres.outputs.DATABASE_NAME
output AZURE_STORAGE_ACCOUNT_NAME string= storageData.outputs.storageAccountName