finops-toolkit icon indicating copy to clipboard operation
finops-toolkit copied to clipboard

[PowerShell] Get-FinOpsHub (0.3)

Open flanakin opened this issue 2 years ago • 2 comments

📝 Scenario

As a hub admin, I need to get hub metadata in order to confirm the hub is setup correctly

💎 Solution

Update the Get-FinOpsHub command to include new settings and resources in 0.3.

Blocked

  • Sync features/exports into dev, then into features/powershell

Synopsis, syntax, description, and parameters should not change. We only need to update the output.

{
  // 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: "...",
  properties: {
    // Version, retention, and scopes pulled from settings.json
    version: "0.3",
    retention: {
      ingestion: {
        months: 13,
      },
      msexports: {
        days: 0,
      },
    },
    scopes: [{
      scope: "...",
    }],

    // Resources determined at runtime via tags or saved in settings.json (TBD)
    resources: {
      dataFactory: "<data-factory-id>",
      keyVault: "<keyvault-id>",
      storage: "<storage-account-id>",
      ...
    },
  }
  }
}

🙋‍♀️ Ask for the community

We could use your help:

  1. Please vote this issue up (👍) to prioritize it.
  2. Are there any parameters that are missing?
  3. Leave comments to help us solidify the vision.

flanakin avatar Aug 14 '23 17:08 flanakin

Would this work item cause this Cmdlet to return the latest deployed version of the template? Currently when I run this, I get this for the version return:

Version   : 0.1

However, I have deployed the 0.3 version and have verified the version by checking the tag on the storage account (+ I have seen the changes implemented in the 0.3 version of the hub).

My use case: writing a deployment pipeline for updating the finops hub version, would be useful to use the Get Cmdlet to check what version is already deployed.

erose96 avatar Apr 01 '24 20:04 erose96

Reviewing the code, I think the first if statement should check for the existence of the ftk-version tag and then if it matches across all of the resources it gets applied to, set the value of $version to the tag value.

erose96 avatar Apr 01 '24 22:04 erose96