From af9a007428b4b0ad6ca397e9e19b4606d8f3ef7c Mon Sep 17 00:00:00 2001 From: Michael Flanakin Date: Sat, 28 Feb 2026 03:11:13 -0800 Subject: [PATCH 01/10] Add -PR, -Scope, and -ManagedExports parameters to Deploy-Hub 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 --- docs-mslearn/toolkit/hubs/configure-scopes.md | 4 +- src/scripts/Deploy-Hub.ps1 | 100 +++++++++++++++++- src/scripts/README.md | 45 +++++--- 3 files changed, 135 insertions(+), 14 deletions(-) diff --git a/docs-mslearn/toolkit/hubs/configure-scopes.md b/docs-mslearn/toolkit/hubs/configure-scopes.md index 9c3b1f10d..bd3b2afe4 100644 --- a/docs-mslearn/toolkit/hubs/configure-scopes.md +++ b/docs-mslearn/toolkit/hubs/configure-scopes.md @@ -224,7 +224,9 @@ Managed exports use a managed identity (MI) to configure the exports automatical - Use the following guides to assign access to each scope you want to monitor: - EA enrollments – [Assign enrollment reader role permission](/azure/cost-management-billing/manage/assign-roles-azure-service-principals#assign-enrollment-account-role-permission-to-the-spn). - EA departments – [Assign department reader role permission](/azure/cost-management-billing/manage/assign-roles-azure-service-principals#assign-enrollment-account-role-permission-to-the-spn). - - Subscriptions and resource groups – [Assign Azure roles using the Azure portal](/azure/role-based-access-control/role-assignments-portal). + - Subscriptions and resource groups – [Assign Azure roles using the Azure portal](/azure/role-based-access-control/role-assignments-portal). Assign the following roles to the hub managed identity on each scope: + - **Cost Management Contributor** – create and manage exports. + - **RBAC Administrator** – required by Cost Management to grant itself access to write export data to the hub storage account.