Skip to content

[PowerShell] Get-FinOpsHub – Get all resources based on nameΒ #341

@flanakin

Description

@flanakin

πŸ“ Scenario

As a hub admin, I need to get metadata about a hub instance with all dependant resources in order to manage delete all resources

πŸ’Ž Solution

Update Get-FinOpsHub command to get all related resources.

Synopsis, syntax, description, and parameters stay the same. The only thing that changes is the output.

ℹ️ Additional info

Use the following code to get any addtional resources that were not identified via the tag:

$kv = $hub.Resources | Where-Object ResourceType -eq "Microsoft.KeyVault/vaults"
$uniqueId = $kv[0].Substring($kv[0].LastIndexOf("-") + 1)

$resources = Get-AzResource -ResourceGroupName $ResourceGroup | Where-Object Name -like "*$uniqueId*"

The output object should look this:

{
  // ID is added as a cm-resource-parent tag to all deployed resources as part of the bicep code
  Id: "/subscriptions/.../resourceGroups/.../providers/Microsoft.Cloud/hubs/...",

  // Type and name can be parsed out of the ID
  Type: "Microsoft.Cloud/hubs",
  Name: "...",

  // Location would be pulled from the resources
  Location: "...",

  // Version pulled from settings.json
  Version: "0.0.1",

  // Resources determined at runtime via tags or with the unique deployment id in the name
  Resources: [
    { ... },
    { ... },
    { ... },
    ...
  ],
}

πŸ™‹β€β™€οΈ Ask for the community

We could use your help:

  1. Please vote this issue up (πŸ‘) to prioritize it.
  2. Leave comments to help us solidify the vision.

Metadata

Metadata

Assignees

Labels

Projects

Status

πŸ— In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions