Skip to content

Conversation

@hemarina
Copy link
Contributor

@hemarina hemarina commented Jan 21, 2026

Fix #5080

This pull request adds support for purging Azure Log Analytics Workspaces during resource group deletion in the Bicep infrastructure provider. The main changes include introducing new methods for identifying and purging Log Analytics Workspaces, updating the destroy logic to handle these resources, and updating dependencies to support the new functionality.

Log Analytics Workspace Purge Support:

  • Added AzCliLogAnalyticsWorkspace struct and related methods to azapi/log_analytics.go for retrieving and purging Log Analytics Workspaces using the Azure SDK.
  • Implemented getLogAnalyticsWorkspacesToPurge and purgeLogAnalyticsWorkspaces methods in bicep_provider.go to identify and purge Log Analytics Workspaces before deleting the resource group. [1] [2]
  • Updated destroyDeployment logic to handle Log Analytics Workspace purge when the purge option is enabled, ensuring these resources are purged before resource group deletion.
  • Modified Destroy method to collect Log Analytics Workspaces to purge and pass them to the destroy logic. [1] [2] [3]

Dependency Updates:

  • Updated go.mod to add the Azure Operational Insights SDK and other dependencies required for Log Analytics Workspace management, as well as version bumps for several indirect dependencies. [1] [2] [3] [4] [5]

Checked in log analytics workspace recycle bin that the workspace is purged.
image

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for purging Log Analytics Workspaces during resource destruction in the Azure Developer CLI. When resources are destroyed with the purge option enabled, Log Analytics Workspaces will now be permanently deleted (using the Force option) rather than soft-deleted.

Changes:

  • Added new Azure SDK dependency for operational insights to support Log Analytics Workspace operations
  • Implemented Log Analytics Workspace purge functionality that uses the Force delete option to bypass soft-delete
  • Integrated Log Analytics purge into the Bicep provider's destroy workflow
  • Updated Go module dependencies (go mod tidy)

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 7 comments.

File Description
cli/azd/pkg/azapi/log_analytics.go New file implementing Log Analytics Workspace client operations (Get, Purge, and client creation)
cli/azd/pkg/infra/provisioning/bicep/bicep_provider.go Integrated Log Analytics purge into destroyDeployment function; added getLogAnalyticsWorkspacesToPurge and purgeLogAnalyticsWorkspaces functions
cli/azd/go.mod Added armoperationalinsights/v2 dependency; moved jsonschema from indirect to direct; updated various transitive dependencies
cli/azd/go.sum Updated checksums for new and updated dependencies

hemarina and others added 6 commits January 20, 2026 18:32
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Issue] Logging doesn't always appear in App Insights and Log Analytics after taking down an environment and redeploying it

2 participants