-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Description
az monitor app-insights component show (list all components) uses API version 2018-05-01-preview, which does not return the workspaceResourceId field. This makes all workspace-based Application Insights resources appear to be classic (non-workspace-based) when listed.
The same command with --app and --resource-group (get single component) correctly uses API version 2020-02-02-preview, which does return the workspaceResourceId field.
Reproduction
# List all - uses api-version=2018-05-01-preview - workspaceResourceId is MISSING
az monitor app-insights component show --debug 2>&1 | grep api-version
# Output: api-version=2018-05-01-preview
az monitor app-insights component show --query "[0].workspaceResourceId" -o json
# Output: null (even for workspace-based resources)
# Get single - uses api-version=2020-02-02-preview - workspaceResourceId is PRESENT
az monitor app-insights component show --app MyAppInsights --resource-group MyRG --debug 2>&1 | grep api-version
# Output: api-version=2020-02-02-preview
az monitor app-insights component show --app MyAppInsights --resource-group MyRG --query "workspaceResourceId" -o json
# Output: "/subscriptions/.../workspaces/my-workspace" (correct)Workaround
Use az rest with the correct API version:
az rest --method get \
--url "https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Insights/components?api-version=2020-02-02"This returns the full resource properties including WorkspaceResourceId for all components.
Impact
- Auditing scripts that list all App Insights resources to check workspace-based migration status will incorrectly report all resources as classic
- AI-assisted infrastructure audits are misled by the missing field, leading to incorrect recommendations
- The
ingestionModefield showsLogAnalyticsin the list output (suggesting workspace-based), but the actual workspace reference is absent, creating a contradictory response
Environment
- Azure CLI: 2.83.0
- application-insights extension: 2.0.0b1 (also reproduced on 1.2.3)
- OS: macOS (darwin 25.2.0)
Expected Fix
Update the list operation in the application-insights extension to use api-version=2020-02-02 (or later) instead of 2018-05-01-preview, matching the API version already used by the single-resource get operation.