[PowerShell] Add-FinOpsHubScope (0.0.1)
đ Scenario
As a hub admin, I need to add scopes to a hub instance in order to start monitoring a new scope
đ Solution
Create an Add-FinOpsHubScope function to create exports and optionally back-fill data.
Synopsis
Starts monitoring a scope within a FinOps hub instance.
Syntax
Add-FinOpsHubScope `
[-Id] <string> `
-HubName <string> `
[-Backfill]
Description
The Add-FinOpsHubScope cmdlet adds a scope to be monitored by a FinOps hub instance. By default, this will start only start pulling data for the current month, which should be available within 30 minutes. To import historical data, use the -Backfill option.
Parameters
| Parameter | Description |
|---|---|
-Id |
Required. Resource ID of the scope to remove. |
-HubName |
Required. Name of the hub instance to update. |
-Backfill |
Optional. Indicates whether to remove data for this scope from storage. Default = false. |
âšī¸ Additional info
In 0.0.1, exports are managed manually. When the command is called, run the following:
$hub = Get-FinOpsHub -Name $HubName
# Validate there's only 1 hub returned
New-FinOpsCostExport `
-Name "$HubName-monthly-AmortizedCost" `
-Scope $Id `
-DataSet AmortizedCost `
-StorageAccountId $hub.properties.resources.storage `
-StorageContainer msexports `
-StoragePath $Id.Trim("/") `
-Execute `
-Backfill 13
đââī¸ Ask for the community
We could use your help:
- Please vote this issue up (đ) to prioritize it.
- Should this be
Add-FinOpsHubScopeorNew-FinOpsHubScope? - Do we want to specify the scope as a single parameter (
-Id) or multiple (-Subscription "..." -ResourceGroup "...") or support both? - How should we identify the hub instance? Do we have enough parameters?
- Should we support adding multiple scopes at one time?
- Are there any parameters that are missing?
- Leave comments to help us solidify the vision.
@sebassem I'm picking this one up as I know you are busy with the Workbook PR. I will sync with you offline to see where you are.
@akiskips
In response to the "đââī¸ Ask for the community" questions...
- Should this be
Add-FinOpsHubScopeorNew-FinOpsHubScope?
- To align more naturally with the
Remove-FinOpsHubScopecommand, my vote is forAdd-FinOpsHubScope.
- Do we want to specify the scope as a single parameter (
-Id) or multiple (-Subscription "..." -ResourceGroup "...") or support both?
- More options are better, as it provides maximum flexibility.
- Should we support adding multiple scopes at one time?
- Yes, absolutely! Support a list or an array of scopes to add.