Skip to content

[Bug Report]: New Diagnostic settings do not support retention #3572

Description

Describe the bug

Receiving an error when trying to deploy a storage account with Diagnostic settings enabled.

I believe it may be related the timelines identified in
https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/migrate-to-azure-storage-lifecycle-policy

Will need a fix for storage account, blob, file, table and queue.

Currently I'm just commenting out but will most likely need further work to clean up old params no longer required.

var diagnosticsMetrics = [for metric in diagnosticMetricsToEnable: {
  category: metric
  timeGrain: null
  enabled: true
  // https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/migrate-to-azure-storage-lifecycle-policy
  //retentionPolicy: {
  //  enabled: true
  //  days: diagnosticLogsRetentionInDays
  //}
}]

To reproduce

Deploy storage with Diagnostic settings enabled

Code snippet

No response

Relevant log output

{
  "code": "BadRequest",
  "message": "Diagnostic settings does not support retention for new diagnostic settings."
}

Activity

  1. added
    bug
    on Aug 13, 2023
  2. johnparkpq commented on Aug 14, 2023

    @johnparkpq

    Same issue with the /network/network-interfaces and /network/public-ip-addresses modules when deploying VMs.
    Commented out retentionPolicy sections in the above modules as suggested by Chris Gibbs (@chris-gibbs) as a workaround.

  3. AlexanderSehr commented on Aug 16, 2023

    @AlexanderSehr
    Contributor

    Hey Chris Gibbs (@chris-gibbs) & John Park (@johnparkpq) , thanks for raising this. I'll take a closer look how to best solve this but would in general suggest to not fix it just for 1, 2 or 3 modules, but for all in one go (assuming that all Providers are supporting the lifecylce changes).

  4. joehubbert commented on Aug 23, 2023

    @joehubbert

    Hi Alexander Sehr (@AlexanderSehr) I just noticed this issue today, is there a fix planned for this?

  5. AlexanderSehr commented on Aug 23, 2023

    @AlexanderSehr
    Contributor

    Hi Alexander Sehr (@AlexanderSehr) I just noticed this issue today, is there a fix planned for this?

    Hey Joe Hubbert (@joehubbert), not yet planned, but it should be fixed. I'm currently on vacation and hence didn't have a closer look yet. I will however try once I'm back next week.

  6. rezamanshouri commented on Aug 23, 2023

    @rezamanshouri

    Encountered the same problem for Storage Account (blob and queue), Event Grid, and cosmos DB.

  7. VanathiGanesh commented on Aug 23, 2023

    @VanathiGanesh

    Our team is encountering the same issue - when can we expect a fix?

  8. Mercy-Markus commented on Aug 24, 2023

    @Mercy-Markus

    Same for my team as well. We have diagnostic settings enable on our App Services.

  9. kschinspari commented on Aug 24, 2023

    @kschinspari

    Our deployment scripts are failing because of this. It started today.
    Any updates would be much appreciated.

  10. DenisBalan commented on Aug 24, 2023

    @DenisBalan

    Same problem, any eta? was there any information about this deprecation prior to this?

    For us, its a major impact as the infrastructure that we provision, suddently fails for all types of resources that had retentionPolicy enabled from terraform.

    Thanks.

  11. rezamanshouri commented on Aug 24, 2023

    @rezamanshouri
  12. jensdiedrich commented on Aug 25, 2023

    @jensdiedrich

    If you change

    diagnosticLogsRetentionInDays to 0 it seems to work.
    Maybe a quick workaround until it´s fixed.

  13. 3 remaining items

  14. moved this from Needs triage to Closed in Bug boardon Aug 28, 2023
  15. Ryangr0 commented on Aug 31, 2023

    @Ryangr0

    Are you kidding me? Deprecation without any notice and a month early... I almost can't believe it. Do you guys realize this kind of stuff is literally breaking prod for your users? This is now the XXth time I'm running into this kind of thing the last few months. The migration guide is atrociously bad and doesn't address setups with proper IAAC approaches...

    Where are the people making these changes? What is their motivation to do these things? Why aren't they the ones in these github threads helping people to fix their broken pipelines? Or better yet, why isn't there a way to notify your users of these changes BEFORE you do them?

  16. AlexanderSehr commented on Aug 31, 2023

    @AlexanderSehr
    Contributor

    Hello Ryan Grippeling (@Ryangr0),

    I just saw your comment, and (as a maintainer) quickly wanted to take the time to respond to your feedback. I assume you're not referring to the Diagnostic-Setting change (in Azure) itself, but the change in this repository (i.e., the linked PR)? I'm just asking because I cannot speak for the former and can only say it appeared to have been announced some time back, given the introduction in the docs.

    Anyways, regarding your experience with this repository I can only say sorry that your experience over the last months has been so bad - and I'll take personal responsiblity for that as I myself worked on most of those breaking changes to somehow hit an upcoming deadline for the Public Registry migration.
    What we opted to do as a heads up for the bumpy ride, was to post a warning on the front page about 4 months back to warn about the breaking changes we were asked to implement, and tag an issue related to this in the issues page. I'm no GitHub expert, so maybe there would have been another way to tell people in advance that changes are coming and that it's probably worth waiting for the next release with most, if not all, breaking changes were implemented.

    I know that it's likely no condolence to say 'just wait for the next release' since (for capacity reasons) we're not creating monthly releases and 'waiting' for 4 months isn't exactly a short timespan. As far as I'm concerned, I'd have like to create way more frequent releases, but with the amount of breaking changes that were asked of us, we opted to rather implement them in one go / release, instead of asking users with each release to migrated from one breaking change to the next.

    Also please note, this repository is run by a number of community members inside and outside of Microsoft. We are no product group and, as we're all doing this on top of our day-to-day job, we can not provide a strict SLA as per our support statement. We further advice in general against pulling directly from main - in case this is what you're refering to with 'breaking production'.

    Again, it is definitely not my, or the rest of the contributors, motivation to give anybody a bad time using this repository. We try our best to continuously evolve both the CI environement and the modules, contribute our learnings - or even correct some odd misalignments of the resource providers (#CMK), and overall share what we can with the general public to enable others to benefit from it. The diagnostic change in particular started failing 60+ module pipelines (the ones that supported diagnostics), so while you're right that this change may have come early, the alternative would have been to not test those modules in our CI anymore (or disable the test itself). Right before our next, and library-wise likely last release, this was not an option.

    Most changes can lead to smaller or bigger breaking changes (e.g., just a single module, mutliple modules, or the CI), and as we're getting contributions from a large amount of contributors, we simply don't have the capacity to provide anything but the atrociously bad migration guide. Or rather, we tried, and failed.

    The alternative would have been to inner-source the project entirely, and if that is considered the better alternative, so be it. With our currently available capacity we (or at least I for my part) cannot offer more.

    All that said, there is hope. As I pointed out earlier, we're not implementing all these changes for the fun of it. In the short- / mid-term, there will be a large-scale migration of the library (not the CI) from this repository into the Public Bicep Registry. This comes we with benefit for the community, that we will not only be able to version modules individually (for those directly using them) - but also scale better by having dedicated individuals 'owning' and maintaining registry modules.

    While all this does obviously not solve your issues, I hope I was at least able to provide some subjective context as to why certain things went the way they did and give a short outlook, where things are moving. Please feel free to reach out if I raised more questions than provided answers.

  17. alexwhitmore commented on Sep 1, 2023

    @alexwhitmore

    According to the migration guide, it is a pre-requisite to send your storage account diagnostic setting logs to a storage account container. If I want to continue sending logs to the Log Analytics Workspace, is there a different migration guide? If I keep my set up as it (sending logs to LAW), and remove the retentionPolicy, I would just retain the logs indefinitely, right?

  18. AlexanderSehr commented on Sep 1, 2023

    @AlexanderSehr
    Contributor

    According to the migration guide, it is a pre-requisite to send your storage account diagnostic setting logs to a storage account container. If I want to continue sending logs to the Log Analytics Workspace, is there a different migration guide? If I keep my set up as it (sending logs to LAW), and remove the retentionPolicy, I would just retain the logs indefinitely, right?

    Hey alex (@alexwhitmore), to my understanding, this change 'only' affects the StorageAccount target for Diagnostic Settings and none of the other options (e.g. LogAnalytics, EventHub, etc.).

    Whether Logs are stored indefinitely in the StorageAccount that backs up the LogAnalyticsWorkspace (and is invisible to us) is a different question and would require a readup on the corresonding docs. I would however assume that there is a maximum rention time in LAW and that, if you want to store logs idenfinitely, you'd need to send them to a custom storage acocunt too (e.g., with an archive tier). Take this statement with a grain of salt though, as this is just my expectation, without having looked deeper into it.

  19. Ryangr0 commented on Sep 4, 2023

    @Ryangr0

    Hey Alexander Sehr (@AlexanderSehr), first of all, let me apologize for my previous outburst lol. I really shouldn't have said it was atrociously bad. It isn't. It's fine. I'd just gotten back from a week off, tried deploying our infra and ran into issues that weren't there before I left, and gor pretty frustrated. (This was only one of three issues)

    I understand the reason these things are changing, and I applaud them. The bicep migration sounds very nice. I applaud you and your team, and colleagues, and especially the people doing this out of the goodness of their hearts. I know this is no easy job.

    The main thing for me is observability. If I have a deployment that has config which will be deprecated, I wish I'd get flagged high priority emails or something that things are about to change. Or warnings/notices on the deployment a week ago, hell, even in the pipeline itself, telling me that certain things are up for change. Anything that would help prevent this kind of situation from happening again.

    This whole space has so many modules, so many different teams, responsibilities, that it's very difficult for me to keep track of upcoming/proposed changes on things our critical infra uses. I don't know the things I don't know, you know? I guess I don't really have a choice besides continue to do my best to figure this all out and just deal with the screw-ups on my end.

    Again, I apologize for getting salty. Definitely not my intention to bring you down. Your efforts are the only reason I have a job I love lol.

  20. AlexanderSehr commented on Sep 4, 2023

    @AlexanderSehr
    Contributor

    Hey Alexander Sehr (@AlexanderSehr), first of all, let me apologize for my previous outburst lol. I really shouldn't have said it was atrociously bad. It isn't. It's fine. I'd just gotten back from a week off, tried deploying our infra and ran into issues that weren't there before I left, and gor pretty frustrated. (This was only one of three issues)

    I understand the reason these things are changing, and I applaud them. The bicep migration sounds very nice. I applaud you and your team, and colleagues, and especially the people doing this out of the goodness of their hearts. I know this is no easy job.

    The main thing for me is observability. If I have a deployment that has config which will be deprecated, I wish I'd get flagged high priority emails or something that things are about to change. Or warnings/notices on the deployment a week ago, hell, even in the pipeline itself, telling me that certain things are up for change. Anything that would help prevent this kind of situation from happening again.

    This whole space has so many modules, so many different teams, responsibilities, that it's very difficult for me to keep track of upcoming/proposed changes on things our critical infra uses. I don't know the things I don't know, you know? I guess I don't really have a choice besides continue to do my best to figure this all out and just deal with the screw-ups on my end.

    Again, I apologize for getting salty. Definitely not my intention to bring you down. Your efforts are the only reason I have a job I love lol.

    Hey Ryan Grippeling (@Ryangr0), no hard feelings. I understand where you're coming from, and if any of us were doing this work full-time, I'd hold the maintainers accountable as well.

    I hope the modules being published & versioned in the actual registry will mitigate some of the challenges. I wonder just how well the observability can be implemented.

    If I think back to PowerShell it's great - you run something and it warns you immediately that xzy parameter may be deprecated. However, I am not aware that any such mechanism exists in ARM, yet alone Bicep.
    An alternative, to maintain a changelog, would also be difficult for consumers as you'd need to actively search in one or multiple of them to see if anything was announced.
    An E-Mail would be an idea if users can subscribe somewhere, though I'd guess that future module owners may announce these changes with not enough lead time. Then again it wouldn't be the worst of things, as a new version (breaking or not) would require a concious update of the user.
    A scenario where you come back after a period and your existing deployment stopped working would then not be an issue anymore - of course unless something changed in the backend - as it did this time around with the DiagnosticSettings. Unfortuantely, I was unable to find a related issue in the Bicep repository, so it may be worth throwing this in as a feature request.

    If you have any suggestions on your end, or have seen something like that somewhere else, please let us know. I'll keep my eyes open and also screen the Bicep-repository-issue-list again.

    Edit: Azure/bicep#11728

  21. alexwhitmore commented on Sep 5, 2023

    @alexwhitmore

    According to the migration guide, it is a pre-requisite to send your storage account diagnostic setting logs to a storage account container. If I want to continue sending logs to the Log Analytics Workspace, is there a different migration guide? If I keep my set up as it (sending logs to LAW), and remove the retentionPolicy, I would just retain the logs indefinitely, right?

    Hey alex (@alexwhitmore), to my understanding, this change 'only' affects the StorageAccount target for Diagnostic Settings and none of the other options (e.g. LogAnalytics, EventHub, etc.).

    Whether Logs are stored indefinitely in the StorageAccount that backs up the LogAnalyticsWorkspace (and is invisible to us) is a different question and would require a readup on the corresonding docs. I would however assume that there is a maximum rention time in LAW and that, if you want to store logs idenfinitely, you'd need to send them to a custom storage acocunt too (e.g., with an archive tier). Take this statement with a grain of salt though, as this is just my expectation, without having looked deeper into it.

    If this change only affects the StorageAccount target for Diagnostic Settings, then I'm assuming removing the retention parameter would prevent my deployment from failing, however that would store the logs in LAW indefinitely - which is not the desired outcome.

    Let's say my storage account logs are sent to the LAW, and I want these logs to be deleted after 365 days. Now that I can't directly set the retention policy, do I still need to implement the Azure Storage Lifecycle Policy?

    As far as I understand, when setting up the lifecycle policy I can only filter for storage account containers which would completely ignore my LAW.

    I apologize in advance if this isn't the place to drop these questions!

  22. davidkarlsen commented on Sep 5, 2023

    @davidkarlsen
    Contributor

    Let's say my storage account logs are sent to the LAW, and I want these logs to be deleted after 365 days. Now that I can't directly set the retention policy, do I still need to implement the Azure Storage Lifecycle Policy?

    As far as I understand, when setting up the lifecycle policy I can only filter for storage account containers which would completely ignore my LAW.

    I apologize in advance if this isn't the place to drop these questions!

    As I understand it - the parameter was only relevant when using a storage-account as the destination for the diagnostic logs - when you send them to LAW you set the retenion in LAW - and not in the source.

  23. AlexanderSehr commented on Sep 5, 2023

    @AlexanderSehr
    Contributor

    Let's say my storage account logs are sent to the LAW, and I want these logs to be deleted after 365 days. Now that I can't directly set the retention policy, do I still need to implement the Azure Storage Lifecycle Policy?
    As far as I understand, when setting up the lifecycle policy I can only filter for storage account containers which would completely ignore my LAW.
    I apologize in advance if this isn't the place to drop these questions!

    As I understand it - the parameter was only relevant when using a storage-account as the destination for the diagnostic logs - when you send them to LAW you set the retenion in LAW - and not in the source.

    Hey David J. M. Karlsen (@davidkarlsen) & alex (@alexwhitmore) ,

    I think David, you're right. Khalid Dermoumi (@khaliddermoumi) opened an issue regarding this more than a year ago (#1000), which unfortunately nobody addressed yet (and no won't need to, I guess). However, he provided a very nice, length description with regards to the retention period.

    Also, I quickly checked and there is a related article to LAW rentention periods you can find here.

  24. khaliddermoumi commented on Sep 5, 2023

    @khaliddermoumi
    Contributor

    Hello Ryan Grippeling (@Ryangr0),

    (...) What we opted to do as a heads up for the bumpy ride, was to post a warning on the front page about 4 months back to warn about the breaking changes we were asked to implement, and tag an issue related to this in the issues page. I'm no GitHub expert, so maybe there would have been another way to tell people in advance that changes are coming and that it's probably worth waiting for the next release with most, if not all, breaking changes were implemented.
    (...) As far as I'm concerned, I'd have like to create way more frequent releases, but with the amount of breaking changes that were asked of us, we opted to rather implement them in one go / release, instead of asking users with each release to migrated from one breaking change to the next.

    BTW a well-known convention to communicate coming breaking changes is to increment the major version number, if you're using semver anyway (version number format "v0.10.0" implies semver). The dev team collects "breaking change requests" for some time, while they make only small compatible releases. When there's enough breaking change requests, they make a breaking release with the major version number bumped. Of course that doesn't work if you choose to stay on v0.x.y all the time. More frequent releases are helpful for this.
    In addition, a changelog is really helpful too.

  25. AlexanderSehr commented on Sep 5, 2023

    @AlexanderSehr
    Contributor

    Hello Ryan Grippeling (@Ryangr0),
    (...) What we opted to do as a heads up for the bumpy ride, was to post a warning on the front page about 4 months back to warn about the breaking changes we were asked to implement, and tag an issue related to this in the issues page. I'm no GitHub expert, so maybe there would have been another way to tell people in advance that changes are coming and that it's probably worth waiting for the next release with most, if not all, breaking changes were implemented.
    (...) As far as I'm concerned, I'd have like to create way more frequent releases, but with the amount of breaking changes that were asked of us, we opted to rather implement them in one go / release, instead of asking users with each release to migrated from one breaking change to the next.

    BTW a well-known convention to communicate coming breaking changes is to increment the major version number, if you're using semver anyway (version number format "v0.10.0" implies semver). The dev team collects "breaking change requests" for some time, while they make only small compatible releases. When there's enough breaking change requests, they make a breaking release with the major version number bumped. Of course that doesn't work if you choose to stay on v0.x.y all the time. More frequent releases are helpful for this. In addition, a changelog is really helpful too.

    Agreed and will be the case post the Public Bicep Registry migration. Will also be a lot better to manage as we can version on a per-module basis instead of 'all in one'. Up until now (and with Bicep not being released in version 1.0) we didn't consider this repository a 1.0 either and hence always bumbed the minor version instead. Not great, but it made sense at the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bug

Type

No type

Projects

  • Status
    Closed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions