microsoft / finops-toolkit

Tools and resources to help you adopt and implement FinOps capabilities that automate and extend the Microsoft Cloud.
https://aka.ms/finops/toolkit
MIT License
271 stars 87 forks source link

Template deployment error when upgrading existing hubs instance to 0.4 #823

Open helderpinto opened 1 month ago

helderpinto commented 1 month ago

🐛 Problem

I tried deploying 0.4 as a new instance and it went well. Connected new CostSummary PBI to it and all seems fine. However, when trying to upgrade 0.3, by deploying the newest 0.4 template on top of it, I am getting the following deployment error, associated with the uploadSettings deployment script:

System.Management.Automation.RuntimeException: The property 'days' cannot be found on this object. Verify that the property exists and can be set.

👣 Repro steps

Deploy the newest hubs template by following the "Deploy to Azure" button available here and choose an existing resource group and existing hubs name on top of which you deploy the hubs template. The existing hubs instance must be version 0.2 or 0.3.

🤔 Expected

A successful deployment and working hubs instance after the upgrade.

AmanuelAZ commented 1 month ago

I am still getting "System.Management.Automation.RuntimeException: The property 'days' cannot be found on this object. Verify that the property exists and can be set." error while trying to upgrade from 0.3 to 0.4

helderpinto commented 1 month ago

@AmanuelAZ, the fix was not published to the main branch yet. We mistakenly closed this issue. I am reopening it. Thanks for letting us know.

@arthurclares, when is this fix expected to merge into main? If we can't publish a new release in the upcoming days, I can share the (very complex) work-around steps here.

helderpinto commented 1 month ago

@AmanuelAZ, there is actually a simpler work-around, if you need to upgrade to 0.4 before the fix is released. You just need to edit the config/settings.json blob in the hubs Storage account (it's as easy as navigating into the config container and edit the blob) and make sure it has a retention block, as follows;

{
  "$schema": "https://aka.ms/finops/hubs/settings-schema",
  "type": "HubInstance",
  "version": "0.3",
  "learnMore": "https://aka.ms/finops/hubs",
  "scopes": {
    "scope": ""
  },
  "retention": {
    "msexports": {
      "days": 0
    },
    "ingestion": {
      "months": 13
    }
  }
}

You don't need to replace the other JSON properties. Just add the retention block and save the blob. After that, redeploying the v0.4 template should work as expected.

AmanuelAZ commented 1 month ago

@helderpinto, thank you for the quick response. I applied the fix, and it resolved the issue for me.

vrondan1983 commented 1 month ago

Hello, the solution that gave @helderpinto works for me , Muchas Gracias !!