Clean up Universal Print Logs and Alerting (Preview)

You only need this page if you want to remove the logs and alerting infrastructure you created in Set up logs and alerting.

Cleanup is handled by the PowerShell script regardless of how you deployed — a PowerShell script, a Bicep template, or an ARM template. The Bicep and ARM templates can only provision resources, not delete them, so there is no cleanup template.

Important

Disable the feature in the Universal Print admin portal before deleting the DCR or workspace. Otherwise the service keeps trying to send telemetry to a destination that no longer exists. See Disable the feature.

Before you begin

  • Download the cleanup script. Get the signed Cleanup-AlertingInfrastructure.ps1 from the Scripts/Alerting/ folder in the Universal Print resources repository.
  • Sign in with Azure PowerShell. Run Connect-AzAccount -TenantId '<tenant-id>' so the script can reach your subscription. For sovereign clouds, add the matching -Environment value on Connect-AzAccount and pass -AzureEnvironment to the cleanup script — for example, -Environment AzureUSGovernment and -AzureEnvironment AzureUSGovernment. Supported values: AzureCloud (default), AzureUSGovernment, AzureChinaCloud.

Run the cleanup script

To remove what the deployment created (by default this deletes only the DCR), run the script from the folder where you downloaded it:

.\Cleanup-AlertingInfrastructure.ps1 `
    -TenantId          '<tenant-id>' `
    -SubscriptionId    '<subscription-id>' `
    -ResourceGroupName '<resource-group-name>' `
    -WorkspaceName     '<workspace-name>'

Substitute your own subscription, resource group, and workspace names — use the same values you used in Set up logs and alerting.

Note

If you set a custom DCR name at setup with -AzDcrName, pass -DcrName <your-name> here. Otherwise the default dcrup-<workspace-name> is used.

Choose how much to remove

By default the script deletes only the Data Collection Rule. Add one or more of the following switches to remove more:

Switch Removes
-DeleteTables The three custom tables (UniversalPrintPrinterHealth_CL, UniversalPrintJob_CL, UniversalPrintBillingSummary_CL).
-DeleteWorkspace The entire Log Analytics workspace (and everything in it).
-DeleteResourceGroup The entire resource group.
-Force Skips the confirmation prompts.

Warning

-DeleteWorkspace and -DeleteResourceGroup are destructive and remove all data they contain, including telemetry you may still want. Confirm you have exported or no longer need the data before using them.

Note

The deployment grants Universal Print's service principal the Monitoring Metrics Publisher role on the Data Collection Rule — the role it uses to publish telemetry. Deleting the DCR removes that role assignment along with it. If you keep the DCR (for example, you delete only the tables), the assignment remains; to revoke it manually, remove it from the DCR's Access control (IAM) blade in the Azure portal.

Need help?

  • PowerShell reference: See the Scripts/Alerting/ folder in the Universal Print resources repository for parameter-by-parameter details.
  • Preview support: Contact your Microsoft representative or open a support ticket referencing "Logs and Alerting (Preview)".

See also