Skip to content

Add tags parameter to main.bicep with enhanced example values and deployment-time CreatedOn - #41

Open
wesmacdonald with Copilot wants to merge 3 commits into
mainfrom
copilot/enhance-tags-configuration
Open

Add tags parameter to main.bicep with enhanced example values and deployment-time CreatedOn#41
wesmacdonald with Copilot wants to merge 3 commits into
mainfrom
copilot/enhance-tags-configuration

Conversation

Copilot AI commented Apr 17, 2026

Copy link
Copy Markdown

infra/main.bicep had no tagging support, leaving all provisioned resources untagged. This adds a tags parameter and propagates it to every resource in the template. The CreatedOn tag is automatically computed at deployment time using utcNow('yyyy-MM-dd') rather than being hardcoded.

Changes

  • infra/main.bicep — new tags parameter with sensible defaults applied to all five resources (Log Analytics Workspace, Application Insights, Container Apps Environment, Manual Job, Scheduled Job); a dedicated param createdOn string = utcNow('yyyy-MM-dd') parameter computes the creation date at deployment time; a resourceTags variable merges the two via union(tags, { CreatedOn: createdOn })
  • infra/main.bicepparam — populated tags with the full recommended tag set (no hardcoded CreatedOn date — it is now always the actual deployment timestamp)
param tags = {
  Environment: 'Production'
  Owner: 'ops-team@company.com'
  CostCenter: 'CC5678'
  Project: 'WebsiteRedesign'
  Department: 'Marketing'
  Confidentiality: 'HighlyConfidential'
  Criticality: 'High'
}
// CreatedOn is automatically set to the deployment date via utcNow('yyyy-MM-dd')

Copilot AI linked an issue Apr 17, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Enhance tags in Bicep configuration Add tags parameter to main.bicep with enhanced example values Apr 17, 2026
Copilot AI requested a review from wesmacdonald April 17, 2026 01:37
@wmacdonald10 wmacdonald10 self-assigned this Apr 22, 2026

@wesmacdonald wesmacdonald left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Created on should be calculated at deployment time

// Define tags as a parameter with default values
@description('Resource tags for all resources')
param tags object = {
Environment: 'Development'
Owner: 'team@company.com'
CostCenter: 'CC1234'
Project: 'MyApplication'
Department: 'Engineering'
CreatedOn: utcNow('yyyy-MM-dd')
Confidentiality: 'Internal'
}

// Example: Apply tags to a storage account
resource storageAccount 'Microsoft.Storage/storageAccounts@2023-01-01' = {
name: 'mystorageaccount'
location: resourceGroup().location
tags: tags
sku: {
name: 'Standard_LRS'
}
kind: 'StorageV2'
}

@wesmacdonald
wesmacdonald marked this pull request as ready for review April 22, 2026 01:27

Copilot AI commented Apr 22, 2026

Copy link
Copy Markdown
Author

Created on should be calculated at deployment time

// Define tags as a parameter with default values...

Done in a597349. Since Bicep restricts utcNow() to string parameter defaults only (it can't be used inside an object literal), I added a dedicated param createdOn string = utcNow('yyyy-MM-dd') and then merged it into the tags via var resourceTags = union(tags, { CreatedOn: createdOn }). All five resources now use resourceTags, and the hardcoded date has been removed from main.bicepparam.

Copilot AI changed the title Add tags parameter to main.bicep with enhanced example values Add tags parameter to main.bicep with enhanced example values and deployment-time CreatedOn Apr 22, 2026
Copilot AI requested a review from wesmacdonald April 22, 2026 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhance tags - see example below

3 participants