Skip to content

[DevOps] PR Builds: Add PR deployment support to Deploy-Hub#2030

Open
flanakin wants to merge 10 commits intodevfrom
flanakin/pr-deploy-hub
Open

[DevOps] PR Builds: Add PR deployment support to Deploy-Hub#2030
flanakin wants to merge 10 commits intodevfrom
flanakin/pr-deploy-hub

Conversation

@flanakin
Copy link
Collaborator

🛠️ Description

Extends Deploy-Hub.ps1 with three new parameters to support CI automation and simplified export configuration:

  • -PR — Sets initials to pr for PR-based naming (e.g., pr-123-adx)
  • -Scope — Configures cost data exports after deployment (managed or manual)
  • -ManagedExports — Uses template-managed exports and grants the hub identity required RBAC roles on the monitored scope

Post-deployment logic handles two paths:

  • Managed exports: Grants Cost Management Contributor and RBAC Administrator on the scope, passes scopesToMonitor to the template
  • Manual exports: Creates a FocusCost export via New-FinOpsCostExport

Also documents the required RBAC roles for subscription/RG scopes in configure-scopes.md.

This is PR A of a multi-PR effort to add per-PR deployment CI for FinOps hubs.

📋 Checklist

🔬 How did you test this change?

  • 🤏 Lint tests
  • 🤞 PS -WhatIf / az validate
  • 👍 Manually deployed + verified
  • 💪 Unit tests
  • 🙌 Integration tests

🙋‍♀️ Do any of the following that apply?

  • 🚨 This is a breaking change.
  • 🤏 The change is less than 20 lines of code.

📑 Did you update docs/changelog.md?

  • ✅ Updated changelog (required for dev PRs)
  • ➡️ Will add log in a future PR (feature branch PRs only)
  • ❎ Log not needed (small/internal change)

📖 Did you update documentation?

  • ✅ Public docs in docs (required for dev)
  • ✅ Public docs in docs-mslearn (required for dev)
  • ✅ Internal dev docs in docs-wiki (required for dev)
  • ✅ Internal dev docs in src (required for dev)
  • ➡️ Will add docs in a future PR (feature branch PRs only)
  • ❎ Docs not needed (small/internal change)

Extends Deploy-Hub.ps1 with CI/automation support:
- -PR switch sets initials to "pr" for PR-based naming (e.g., pr-123)
- -Scope configures cost data exports after deployment
- -ManagedExports uses template-managed exports with RBAC setup

Post-deployment handles both managed exports (grants Cost Management
Contributor and RBAC Administrator on the monitored scope) and manual
exports (creates FocusCost export via New-FinOpsCostExport).

Also documents required RBAC roles for subscription/RG scopes in
configure-scopes.md.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Copilot AI review requested due to automatic review settings February 28, 2026 11:12
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends Deploy-Hub.ps1 with three new parameters (-PR, -Scope, -ManagedExports) to support CI/PR-based deployments and export configuration. It also documents required RBAC roles for subscription/resource group scopes in configure-scopes.md.

Changes:

  • Added -PR, -Scope, and -ManagedExports parameters to Deploy-Hub.ps1, including post-deployment logic to either grant managed identity RBAC roles or create a manual FocusCost export via New-FinOpsCostExport
  • Updated src/scripts/README.md with new parameter documentation and usage examples
  • Updated docs-mslearn/toolkit/hubs/configure-scopes.md to document the required roles (Cost Management Contributor and RBAC Administrator) for subscription/resource group scopes

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/scripts/Deploy-Hub.ps1 Core changes: new parameters, initials logic for PR mode, managed/manual export configuration post-deployment
src/scripts/README.md Updated parameter table and new usage examples for -PR, -Scope, and -ManagedExports
docs-mslearn/toolkit/hubs/configure-scopes.md Added documentation for RBAC roles needed for subscription/resource group scopes with managed exports

@flanakin flanakin changed the title Add -PR, -Scope, and -ManagedExports to Deploy-Hub [DevOps] PR Builds: Add PR deployment support to Deploy-Hub Feb 28, 2026
flanakin and others added 2 commits February 28, 2026 22:49
- Add "Optional." prefix to -PR parameter doc
- Fix enableManagedExports default: explicitly set to $false for manual exports
- Check New-AzRoleAssignment result before reporting success
- Fix comment: "Build" → "Import" for module load

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@flanakin
Copy link
Collaborator Author

flanakin commented Mar 1, 2026

🤖 [AI][Claude] PR Update Summary

Addressed: 4 thread(s)

  • ✅ Implemented: 4
  1. Added "Optional." prefix to -PR parameter doc
  2. Explicitly set enableManagedExports = $false for manual exports path (template defaults to true)
  3. Check New-AzRoleAssignment result before reporting success, warn on failure
  4. Fixed comment: "Build" → "Import" for module load

@flanakin flanakin enabled auto-merge (squash) March 1, 2026 07:04
@flanakin flanakin added Skill: DevOps GitHub setup and automation Tool: FinOps hubs Data pipeline solution labels Mar 1, 2026
@flanakin flanakin added this to the v14 milestone Mar 2, 2026
@RolandKrummenacher

This comment was marked as duplicate.

@RolandKrummenacher

This comment was marked as duplicate.

RolandKrummenacher

This comment was marked as duplicate.

- Remove RBAC Administrator from monitored scope (template handles it on storage account)
- Change -PR from [switch] to [int] that takes the PR number
- Set $initials to "pr-{number}" so naming flows through shared logic (e.g., pr-123-adx)
- Update docs and examples to reflect new -PR behavior

🤖 Generated with [Claude Code](https://claude.ai/claude-code)

Co-Authored-By: RolandKrummenacher <[email protected]>
Co-Authored-By: Claude <[email protected]>
@flanakin
Copy link
Collaborator Author

flanakin commented Mar 4, 2026

🤖 [AI][Claude] PR Update Summary

Addressed: 2 thread(s)

  • ✅ Implemented: 2
  1. Removed RBAC Administrator from monitored scope — template already handles it on the storage account
  2. Changed -PR from [switch] to [int] — takes the PR number directly, -Name serves as optional suffix for deployment variations (e.g., pr-123-adx)

@flanakin flanakin disabled auto-merge March 10, 2026 10:33
- Inline Cost Management Contributor role instead of nested bullet list

🤖 Generated with [Claude Code](https://claude.ai/claude-code)

Co-Authored-By: RolandKrummenacher <[email protected]>
Co-Authored-By: Claude <[email protected]>
@flanakin
Copy link
Collaborator Author

🤖 [AI][Claude] PR Update Summary

Addressed: 1 thread(s)

  • ✅ Implemented: 1

Simplified single-role documentation — inlined Cost Management Contributor into parent bullet instead of nested list.

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: DevOps GitHub setup and automation Tool: FinOps hubs Data pipeline solution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants