Skip to content

refactor: centralize Azure resource naming with abbreviations.json and update Bicep templates #1795

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
227 changes: 227 additions & 0 deletions infra/abbreviations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
{
"ai": {
"aiSearch": "srch-",
"aiServices": "aisa-",
"aiVideoIndexer": "avi-",
"machineLearningWorkspace": "mlw-",
"openAIService": "oai-",
"botService": "bot-",
"computerVision": "cv-",
"contentModerator": "cm-",
"contentSafety": "cs-",
"customVisionPrediction": "cstv-",
"customVisionTraining": "cstvt-",
"documentIntelligence": "di-",
"faceApi": "face-",
"healthInsights": "hi-",
"immersiveReader": "ir-",
"languageService": "lang-",
"speechService": "spch-",
"translator": "trsl-",
"aiHub": "aih-",
"aiHubProject": "aihp-"
},
"analytics": {
"analysisServicesServer": "as",
"databricksWorkspace": "dbw-",
"dataExplorerCluster": "dec",
"dataExplorerClusterDatabase": "dedb",
"dataFactory": "adf-",
"digitalTwin": "dt-",
"streamAnalytics": "asa-",
"synapseAnalyticsPrivateLinkHub": "synplh-",
"synapseAnalyticsSQLDedicatedPool": "syndp",
"synapseAnalyticsSparkPool": "synsp",
"synapseAnalyticsWorkspaces": "synw",
"dataLakeStoreAccount": "dls",
"dataLakeAnalyticsAccount": "dla",
"eventHubsNamespace": "evhns-",
"eventHub": "evh-",
"eventGridDomain": "evgd-",
"eventGridSubscriptions": "evgs-",
"eventGridTopic": "evgt-",
"eventGridSystemTopic": "egst-",
"hdInsightHadoopCluster": "hadoop-",
"hdInsightHBaseCluster": "hbase-",
"hdInsightKafkaCluster": "kafka-",
"hdInsightSparkCluster": "spark-",
"hdInsightStormCluster": "storm-",
"hdInsightMLServicesCluster": "mls-",
"iotHub": "iot-",
"provisioningServices": "provs-",
"provisioningServicesCertificate": "pcert-",
"powerBIEmbedded": "pbi-",
"timeSeriesInsightsEnvironment": "tsi-"
},
"compute": {
"appServiceEnvironment": "ase-",
"appServicePlan": "asp-",
"loadTesting": "lt-",
"availabilitySet": "avail-",
"arcEnabledServer": "arcs-",
"arcEnabledKubernetesCluster": "arck",
"batchAccounts": "ba-",
"cloudService": "cld-",
"communicationServices": "acs-",
"diskEncryptionSet": "des",
"functionApp": "func-",
"gallery": "gal",
"hostingEnvironment": "host-",
"imageTemplate": "it-",
"managedDiskOS": "osdisk",
"managedDiskData": "disk",
"notificationHubs": "ntf-",
"notificationHubsNamespace": "ntfns-",
"proximityPlacementGroup": "ppg-",
"restorePointCollection": "rpc-",
"snapshot": "snap-",
"staticWebApp": "stapp-",
"virtualMachine": "vm",
"virtualMachineScaleSet": "vmss-",
"virtualMachineMaintenanceConfiguration": "mc-",
"virtualMachineStorageAccount": "stvm",
"webApp": "app-"
},
"containers": {
"aksCluster": "aks-",
"aksSystemNodePool": "npsystem-",
"aksUserNodePool": "np-",
"containerApp": "ca-",
"containerAppsEnvironment": "cae-",
"containerRegistry": "cr",
"containerInstance": "ci",
"serviceFabricCluster": "sf-",
"serviceFabricManagedCluster": "sfmc-"
},
"databases": {
"cosmosDBDatabase": "cosmos-",
"cosmosDBApacheCassandra": "coscas-",
"cosmosDBMongoDB": "cosmon-",
"cosmosDBNoSQL": "cosno-",
"cosmosDBTable": "costab-",
"cosmosDBGremlin": "cosgrm-",
"cosmosDBPostgreSQL": "cospos-",
"cacheForRedis": "redis-",
"sqlDatabaseServer": "sql-",
"sqlDatabase": "sqldb-",
"sqlElasticJobAgent": "sqlja-",
"sqlElasticPool": "sqlep-",
"mariaDBServer": "maria-",
"mariaDBDatabase": "mariadb-",
"mySQLDatabase": "mysql-",
"postgreSQLDatabase": "psql-",
"sqlServerStretchDatabase": "sqlstrdb-",
"sqlManagedInstance": "sqlmi-"
},
"developerTools": {
"appConfigurationStore": "appcs-",
"mapsAccount": "map-",
"signalR": "sigr",
"webPubSub": "wps-"
},
"devOps": {
"managedGrafana": "amg-"
},
"integration": {
"apiManagementService": "apim-",
"integrationAccount": "ia-",
"logicApp": "logic-",
"serviceBusNamespace": "sbns-",
"serviceBusQueue": "sbq-",
"serviceBusTopic": "sbt-",
"serviceBusTopicSubscription": "sbts-"
},
"managementGovernance": {
"automationAccount": "aa-",
"applicationInsights": "appi-",
"monitorActionGroup": "ag-",
"monitorDataCollectionRules": "dcr-",
"monitorAlertProcessingRule": "apr-",
"blueprint": "bp-",
"blueprintAssignment": "bpa-",
"dataCollectionEndpoint": "dce-",
"logAnalyticsWorkspace": "log-",
"logAnalyticsQueryPacks": "pack-",
"managementGroup": "mg-",
"purviewInstance": "pview-",
"resourceGroup": "rg-",
"templateSpecsName": "ts-"
},
"migration": {
"migrateProject": "migr-",
"databaseMigrationService": "dms-",
"recoveryServicesVault": "rsv-"
},
"networking": {
"applicationGateway": "agw-",
"applicationSecurityGroup": "asg-",
"cdnProfile": "cdnp-",
"cdnEndpoint": "cdne-",
"connections": "con-",
"dnsForwardingRuleset": "dnsfrs-",
"dnsPrivateResolver": "dnspr-",
"dnsPrivateResolverInboundEndpoint": "in-",
"dnsPrivateResolverOutboundEndpoint": "out-",
"firewall": "afw-",
"firewallPolicy": "afwp-",
"expressRouteCircuit": "erc-",
"expressRouteGateway": "ergw-",
"frontDoorProfile": "afd-",
"frontDoorEndpoint": "fde-",
"frontDoorFirewallPolicy": "fdfp-",
"ipGroups": "ipg-",
"loadBalancerInternal": "lbi-",
"loadBalancerExternal": "lbe-",
"loadBalancerRule": "rule-",
"localNetworkGateway": "lgw-",
"natGateway": "ng-",
"networkInterface": "nic-",
"networkSecurityGroup": "nsg-",
"networkSecurityGroupSecurityRules": "nsgsr-",
"networkWatcher": "nw-",
"privateLink": "pl-",
"privateEndpoint": "pep-",
"publicIPAddress": "pip-",
"publicIPAddressPrefix": "ippre-",
"routeFilter": "rf-",
"routeServer": "rtserv-",
"routeTable": "rt-",
"serviceEndpointPolicy": "se-",
"trafficManagerProfile": "traf-",
"userDefinedRoute": "udr-",
"virtualNetwork": "vnet-",
"virtualNetworkGateway": "vgw-",
"virtualNetworkManager": "vnm-",
"virtualNetworkPeering": "peer-",
"virtualNetworkSubnet": "snet-",
"virtualWAN": "vwan-",
"virtualWANHub": "vhub-"
},
"security": {
"bastion": "bas-",
"keyVault": "kv-",
"keyVaultManagedHSM": "kvmhsm-",
"managedIdentity": "id-",
"sshKey": "sshkey-",
"vpnGateway": "vpng-",
"vpnConnection": "vcn-",
"vpnSite": "vst-",
"webApplicationFirewallPolicy": "waf",
"webApplicationFirewallPolicyRuleGroup": "wafrg"
},
"storage": {
"storSimple": "ssimp",
"backupVault": "bvault-",
"backupVaultPolicy": "bkpol-",
"fileShare": "share-",
"storageAccount": "st",
"storageSyncService": "sss-"
},
"virtualDesktop": {
"labServicesPlan": "lp-",
"virtualDesktopHostPool": "vdpool-",
"virtualDesktopApplicationGroup": "vdag-",
"virtualDesktopWorkspace": "vdws-",
"virtualDesktopScalingPlan": "vdscaling-"
}
}
2 changes: 1 addition & 1 deletion infra/core/security/managed-identity.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ param solutionName string
param solutionLocation string

@description('Name')
param miName string = '${ solutionName }-managed-identity'
param miName string

resource managedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = {
name: miName
Expand Down
36 changes: 19 additions & 17 deletions infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ targetScope = 'subscription'
@maxLength(20)
@description('Name of the the environment which is used to generate a short unique hash used in all resources.')
param environmentName string
var abbrs = loadJsonContent('./abbreviations.json')

param resourceToken string = toLower(uniqueString(subscription().id, environmentName, location))

@description('Location for all resources.')
param location string

@description('Name of App Service plan')
param hostingPlanName string = 'hosting-plan-${resourceToken}'
var hostingPlanName = '${abbrs.compute.appServicePlan}${resourceToken}'

@description('The pricing tier for the App Service plan')
@allowed([
Expand Down Expand Up @@ -50,19 +51,19 @@ param skuTier string = 'Basic'
param databaseType string = 'PostgreSQL'

@description('Azure Cosmos DB Account Name')
param azureCosmosDBAccountName string = 'cosmos-${resourceToken}'
var azureCosmosDBAccountName = '${abbrs.databases.cosmosDBDatabase}${resourceToken}'

@description('Azure Postgres DB Account Name')
param azurePostgresDBAccountName string = 'postgres-${resourceToken}'
var azurePostgresDBAccountName = '${abbrs.databases.postgreSQLDatabase}${resourceToken}'

@description('Name of Web App')
param websiteName string = 'web-${resourceToken}'
var websiteName = '${abbrs.compute.webApp}${resourceToken}'

@description('Name of Admin Web App')
param adminWebsiteName string = '${websiteName}-admin'
var adminWebsiteName = '${websiteName}-admin'

@description('Name of Application Insights')
param applicationInsightsName string = 'appinsights-${resourceToken}'
var applicationInsightsName = '${abbrs.managementGovernance.applicationInsights}${resourceToken}'

@description('Name of the Workbook')
param workbookDisplayName string = 'workbook-${resourceToken}'
Expand Down Expand Up @@ -119,7 +120,7 @@ param azureSearchUrlColumn string = 'url'
param azureSearchUseIntegratedVectorization bool = false

@description('Name of Azure OpenAI Resource')
param azureOpenAIResourceName string = 'openai-${resourceToken}'
var azureOpenAIResourceName = '${abbrs.ai.openAIService}${resourceToken}'

@description('Name of Azure OpenAI Resource SKU')
param azureOpenAISkuName string = 'S0'
Expand Down Expand Up @@ -204,7 +205,7 @@ param azureOpenAIEmbeddingModelVersion string = '2'
param azureOpenAIEmbeddingModelCapacity int = 30

@description('Name of Computer Vision Resource (if useAdvancedImageProcessing=true)')
param computerVisionName string = 'computer-vision-${resourceToken}'
var computerVisionName = '${abbrs.ai.computerVision}${resourceToken}'

@description('Name of Computer Vision Resource SKU (if useAdvancedImageProcessing=true)')
@allowed([
Expand Down Expand Up @@ -234,7 +235,7 @@ param computerVisionVectorizeImageApiVersion string = '2024-02-01'
param computerVisionVectorizeImageModelVersion string = '2023-04-15'

@description('Azure AI Search Resource')
param azureAISearchName string = 'search-${resourceToken}'
var azureAISearchName = '${abbrs.ai.aiSearch}${resourceToken}'

@description('The SKU of the search service you want to create. E.g. free or standard')
@allowed([
Expand All @@ -259,22 +260,22 @@ param azureSearchDatasource string = 'datasource-${resourceToken}'
param azureSearchConversationLogIndex string = 'conversations'

@description('Name of Storage Account')
param storageAccountName string = 'str${resourceToken}'
var storageAccountName = '${abbrs.storage.storageAccount}${resourceToken}'

@description('Name of Function App for Batch document processing')
param functionName string = 'backend-${resourceToken}'
var functionName = '${abbrs.compute.functionApp}${resourceToken}'

@description('Azure Form Recognizer Name')
param formRecognizerName string = 'formrecog-${resourceToken}'
var formRecognizerName = '${abbrs.ai.documentIntelligence}${resourceToken}'

@description('Azure Content Safety Name')
param contentSafetyName string = 'contentsafety-${resourceToken}'
var contentSafetyName = '${abbrs.ai.contentSafety}${resourceToken}'

@description('Azure Speech Service Name')
param speechServiceName string = 'speech-${resourceToken}'
var speechServiceName = '${abbrs.ai.speechService}${resourceToken}'

@description('Log Analytics Name')
param logAnalyticsName string = 'la-${resourceToken}'
var logAnalyticsName = '${abbrs.managementGovernance.logAnalyticsWorkspace}${resourceToken}'

param newGuidString string = newGuid()
param searchTag string = 'chatwithyourdata-sa'
Expand Down Expand Up @@ -308,15 +309,15 @@ param logLevel string = 'INFO'
param recognizedLanguages string = 'en-US,fr-FR,de-DE,it-IT'

@description('Azure Machine Learning Name')
param azureMachineLearningName string = 'aml-${resourceToken}'
var azureMachineLearningName = '${abbrs.ai.machineLearningWorkspace}${resourceToken}'

var blobContainerName = 'documents'
var queueName = 'doc-processing'
var clientKey = '${uniqueString(guid(subscription().id, deployment().name))}${newGuidString}'
var eventGridSystemTopicName = 'doc-processing'
var tags = { 'azd-env-name': environmentName }
var rgName = 'rg-${environmentName}'
var keyVaultName = 'kv-${resourceToken}'
var keyVaultName = '${abbrs.security.keyVault}${resourceToken}'
var baseUrl = 'https://raw.githubusercontent.com/Azure-Samples/chat-with-your-data-solution-accelerator/main/'

var appversion = 'latest' // Update GIT deployment branch
Expand Down Expand Up @@ -351,6 +352,7 @@ resource rg 'Microsoft.Resources/resourceGroups@2021-04-01' = {
module managedIdentityModule './core/security/managed-identity.bicep' = if (databaseType == 'PostgreSQL') {
name: 'deploy_managed_identity'
params: {
miName: '${abbrs.security.managedIdentity}${resourceToken}'
solutionName: resourceToken
solutionLocation: location
}
Expand Down
Loading