diff --git a/src/templates/finops-hub/modules/hub-app.bicep b/src/templates/finops-hub/modules/hub-app.bicep index bb05e5e75..aff1b32a4 100644 --- a/src/templates/finops-hub/modules/hub-app.bicep +++ b/src/templates/finops-hub/modules/hub-app.bicep @@ -38,6 +38,15 @@ param features HubAppFeature[] = [] @description('Optional. Custom string with additional metadata to log. Must an alphanumeric string without spaces or special characters except for underscores and dashes. Namespace + appName + telemetryString must be 50 characters or less - additional characters will be trimmed.') param telemetryString string = '' +@description('Optional. Custom name for the Storage Account. If not provided, a name will be generated based on the hub name.') +param storageAccountName string = '' + +@description('Optional. Custom name for the Data Factory. If not provided, a name will be generated based on the hub name.') +param dataFactoryName string = '' + +@description('Optional. Custom name for the Key Vault. If not provided, a name will be generated based on the hub name.') +param keyVaultName string = '' + //------------------------------------------------------------------------------ // Temporary parameters that should be removed in the future //------------------------------------------------------------------------------ @@ -51,7 +60,17 @@ param coreConfig HubCoreConfig // Variables //============================================================================== -var appConfig = newAppConfig(coreConfig, publisher, namespace, appName, displayName, appVersion) +var appConfig = newAppConfig( + coreConfig, + publisher, + namespace, + appName, + displayName, + appVersion, + storageAccountName, + dataFactoryName, + keyVaultName +) // Features var usesDataFactory = contains(features, 'DataFactory') diff --git a/src/templates/finops-hub/modules/hub-types.bicep b/src/templates/finops-hub/modules/hub-types.bicep index 5d944b7d4..1620e0cd2 100644 --- a/src/templates/finops-hub/modules/hub-types.bicep +++ b/src/templates/finops-hub/modules/hub-types.bicep @@ -349,6 +349,9 @@ func newAppInternalConfig( appNamespace string, displayName string, version string, + customStorageName string, + customDataFactoryName string, + customKeyVaultName string ) HubAppConfig => { ...coreConfig publisher: { @@ -359,13 +362,13 @@ func newAppInternalConfig( tags: union(coreConfig.hub.tags, publisherTags) // Globally unique Data Factory name: 3-63 chars; letters, numbers, non-repeating dashes - dataFactory: replace('${take('${replace(coreConfig.hub.name, '_', '-')}-engine', 63 - length(publisherSuffix))}${publisherSuffix}', '--', '-') + dataFactory: !empty(customDataFactoryName) ? customDataFactoryName : replace('${take('${replace(coreConfig.hub.name, '_', '-')}-engine', 63 - length(publisherSuffix))}${publisherSuffix}', '--', '-') // Globally unique KeyVault name: 3-24 chars; letters, numbers, dashes - keyVault: replace('${take('${replace(coreConfig.hub.name, '_', '-')}-vault', 24 - length(publisherSuffix))}${publisherSuffix}', '--', '-') + keyVault: !empty(customKeyVaultName) ? customKeyVaultName : replace('${take('${replace(coreConfig.hub.name, '_', '-')}-vault', 24 - length(publisherSuffix))}${publisherSuffix}', '--', '-') // Globally unique storage account name: 3-24 chars; lowercase letters/numbers only - storage: '${take(coreConfig.hub.safeName, 24 - length(publisherSuffix))}${publisherSuffix}' + storage: !empty(customStorageName) ? customStorageName : '${take(coreConfig.hub.safeName, 24 - length(publisherSuffix))}${publisherSuffix}' } app: { // id: '${hubResourceId}/publishers/${namespace}/apps/${appName}' @@ -389,6 +392,9 @@ func newAppConfig( appName string, displayName string, version string, + customStorageName string = '', + customDataFactoryName string = '', + customKeyVaultName string = '' ) HubAppConfig => newAppInternalConfig( config, publisher, @@ -398,7 +404,10 @@ func newAppConfig( appName, '${namespace}.${appName}', // appNamespace displayName, - version + version, + customStorageName, + customDataFactoryName, + customKeyVaultName ) @export() diff --git a/src/templates/finops-hub/modules/hub.bicep b/src/templates/finops-hub/modules/hub.bicep index 68f5e59fb..f4e9e7935 100644 --- a/src/templates/finops-hub/modules/hub.bicep +++ b/src/templates/finops-hub/modules/hub.bicep @@ -17,6 +17,16 @@ param location string = resourceGroup().location // @description('Optional. Azure location to use for a temporary Event Grid namespace to register the Microsoft.EventGrid resource provider if the primary location is not supported. The namespace will be deleted and is not used for hub operation. Default: "" (same as location).') // param eventGridLocation string = '' +@description('Optional. Custom name for the Storage Account. If not provided, a name will be generated based on the hub name.') +param storageAccountName string = '' + +@description('Optional. Custom name for the Data Factory. If not provided, a name will be generated based on the hub name.') +param dataFactoryName string = '' + +@description('Optional. Custom name for the Key Vault. If not provided, a name will be generated based on the hub name.') + +param keyVaultName string = '' + @allowed([ 'Premium_LRS' 'Premium_ZRS' @@ -302,6 +312,9 @@ module appRegistration 'hub-app.bicep' = { 'Storage' ] telemetryString: telemetryString + storageAccountName: storageAccountName + dataFactoryName: dataFactoryName + keyVaultName: keyVaultName coreConfig: coreConfig }