Skip to content

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

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

Draft
wants to merge 6 commits into
base: dev
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented May 25, 2025

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.

Co-authored-by: flanakin <399533+flanakin@users.noreply.github.com>
Copilot AI and others added 2 commits May 25, 2025 17:46
Co-authored-by: flanakin <399533+flanakin@users.noreply.github.com>
Co-authored-by: flanakin <399533+flanakin@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] [BICEP] FinOps Toolkit - Custom resource naming [BICEP] Add support for custom resource naming in FinOps Toolkit May 25, 2025
Copilot finished work on behalf of flanakin May 25, 2025 17:50
Comment on lines 188 to 190
storageAccountName: storageAccountName
dataFactoryName: dataFactoryName
keyVaultName: keyVaultName
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted the parameter pass-through in main.bicep (commit 66f9c8f)

Comment on lines 150 to 158
@description('Optional. Custom name for the Storage Account. If not provided, a name will be generated based on the hub name. Must follow Azure Storage naming rules.')
param storageAccountName string = ''

@description('Optional. Custom name for the Data Factory. If not provided, a name will be generated based on the hub name. Must follow Azure Data Factory naming rules.')
param dataFactoryName string = ''

@description('Optional. Custom name for the Key Vault. If not provided, a name will be generated based on the hub name. Must follow Azure Key Vault naming rules.')
param keyVaultName string = ''

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted the custom resource naming parameters in main.bicep (commit 66f9c8f)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert this file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this file as requested (commit 66f9c8f)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert this file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this file as requested (commit 66f9c8f)

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Attention 👋 Issue or PR needs to be reviewed by the author or it will be closed due to no activity and removed Needs: Review 👀 PR that is ready to be reviewed labels May 25, 2025
Co-authored-by: flanakin <399533+flanakin@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Review 👀 PR that is ready to be reviewed and removed Needs: Attention 👋 Issue or PR needs to be reviewed by the author or it will be closed due to no activity labels May 25, 2025
Copilot finished work on behalf of flanakin May 25, 2025 19:05
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot You reverted too much. The storage, ADF, and Key Vault names should be specified in hub.bicep and passed down to hub-app.bicep.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've restored the storage, ADF, and Key Vault name parameters in hub.bicep and hub-app.bicep while ensuring they're properly passed through the module chain. The parameters are now available in hub.bicep and passed down to hub-app.bicep as requested (commit 3cb5af8).

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Attention 👋 Issue or PR needs to be reviewed by the author or it will be closed due to no activity and removed Needs: Review 👀 PR that is ready to be reviewed labels May 25, 2025
…icep

Co-authored-by: flanakin <399533+flanakin@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented May 25, 2025

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:

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Review 👀 PR that is ready to be reviewed and removed Needs: Attention 👋 Issue or PR needs to be reviewed by the author or it will be closed due to no activity labels May 25, 2025
Copilot finished work on behalf of flanakin May 25, 2025 19:15
@flanakin flanakin added this to the 2025-06 - June milestone May 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Review 👀 PR that is ready to be reviewed Skill: Deployment Resource deployment automation via bicep or terraform Skill: DevOps GitHub setup and automation Skill: Documentation Documentation updates Tool: FinOps guide Implementing FinOps guide Tool: FinOps hubs Data pipeline solution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BICEP] FinOps Toolkit - Custom resource naming
10 participants