finops-toolkit icon indicating copy to clipboard operation
finops-toolkit copied to clipboard

[BICEP] Add support for custom resource naming in FinOps Toolkit

Open Copilot opened this issue 9 months ago • 1 comments

Overview

This PR adds support for custom resource naming in the FinOps Toolkit Bicep deployment, allowing organizations to follow their naming standards when deploying FinOps resources.

Changes Made

  • Added new parameters to main.bicep:
    • storageAccountName: Custom name for the Storage Account
    • dataFactoryName: Custom name for the Data Factory
    • keyVaultName: Custom name for the Key Vault
  • Updated the parameter chain to pass these values through hub.bicep and hub-app.bicep
  • Modified the name generation logic in hub-types.bicep to use custom names when provided, falling back to the auto-generated names for backward compatibility

Example Usage

With these changes, consumers can specify their own resource names:

module finopsHub 'br/public:finops/hub:latest' = {
  name: 'finopsHub'
  params: {
    hubName: 'prod-finops'
    storageAccountName: 'companyfinopsdata001'
    dataFactoryName: 'company-finops-ingestion-001'
    keyVaultName: 'company-finops-vault-001'
  }
}

Or use a company naming module:

module finopsHub 'br/public:finops/hub:latest' = {
  name: 'finopsHub'
  params: {
    hubName: 'prod-finops'
    storageAccountName: naming.storageAccount('finops-data')
    dataFactoryName: naming.dataFactory('finops-engine')
    keyVaultName: naming.keyVault('finops-vault')
  }
}

Backward Compatibility

All parameters have empty string defaults, ensuring backward compatibility with existing deployments. When a parameter is not specified, the resource name is generated using the original logic based on the hub name.

Fixes #1105.

[!WARNING]

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • aka.ms
    • Triggering command: bicep build src/templates/finops-hub/main.bicep (dns block)
    • Triggering command: bicep build src/templates/finops-hub/modules/hub-types.bicep (dns block)
    • Triggering command: bicep build src/templates/finops-hub/modules/hub-app.bicep (dns block)
  • app.aladdin.microsoft.com
    • Triggering command: /usr/bin/../../opt/az/bin/python3 -Im azure.cli bicep build --file src/templates/finops-hub/main.bicep --force (dns block)
  • cdn.fwupd.org
    • Triggering command: /usr/bin/fwupdmgr refresh (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot avatar May 25 '25 17:05 Copilot

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

[!WARNING]

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • aka.ms
    • Triggering command: bicep build src/templates/finops-hub/modules/hub.bicep (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot avatar May 25 '25 19:05 Copilot