Skip to content

Commit f2addc8

Browse files
authored
Update convert-classic-resource.md
1 parent 20e2a02 commit f2addc8

File tree

1 file changed

+6
-38
lines changed

1 file changed

+6
-38
lines changed

articles/azure-monitor/app/convert-classic-resource.md

Lines changed: 6 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -122,49 +122,17 @@ When you query directly from the Log Analytics workspace, you only see data that
122122
> If you rename your Application Insights resource after you migrate to the workspace-based model, the Application Insights **Logs** tab no longer shows the telemetry collected before renaming. You can see all old and new data on the **Logs** tab of the associated Log Analytics resource.
123123
124124

125-
## How to identify the Application Insights resources based on the ingestion types:
125+
## Identifying the Application Insights resources by ingestion type
126126

127-
The below powershell script helps customers identify their Applicaiton Insights resources based on the ingestion types.
127+
Use the following script to identify your Application Insights resources by ingestion type.
128128

129129
#### Example
130130

131-
```powershell
132-
$subscription = "Your Subscription ID"
133-
# $AzureContenxt = Connect-AzAccount ## this is part of Az.Accounts module
134-
$token = (Get-AZAccessToken).Token
135-
$header = @{Authorization = "Bearer $token"}
136-
$uri = "https://management.azure.com/subscriptions/$subscription/providers/Microsoft.Insights/components?api-version=2015-05-01"
137-
$RestResult=""
138-
$RestResult = Invoke-RestMethod -Method GET -Uri $uri -Headers $header -ContentType "application/json" -ErrorAction Stop -Verbose
139-
140-
$list=@()
141-
$ClassicList=@()
142-
foreach ($app in $RestResult.value)
143-
{
144-
#"processing: " + $app.properties.WorkspaceResourceId ## Classic Application Insights do not have a workspace.
145-
if ($app.properties.WorkspaceResourceId)
146-
{
147-
$Obj = New-Object -TypeName PSObject
148-
#$app.properties.WorkspaceResourceId
149-
$Obj | Add-Member -Type NoteProperty -Name Name -Value $app.name
150-
$Obj | Add-Member -Type NoteProperty -Name WorkspaceResourceId -Value $app.properties.WorkspaceResourceId
151-
$list += $Obj
152-
}
153-
else
154-
{
155-
$Obj = New-Object -TypeName PSObject
156-
$app.properties.WorkspaceResourceId
157-
$Obj | Add-Member -Type NoteProperty -Name Name -Value $app.name
158-
$ClassicList += $Obj
159-
160-
}
161-
}
162-
$list |Format-Table -Property Name, WorkspaceResourceId -Wrap
163-
164-
"";"Classic:"
165-
$ClassicList | FT
166-
```
131+
```azurecli
167132
133+
Get-AzApplicationInsights -SubscriptionId '7faeaa41-541f-48da-82b4-3dc10c594b85' | Format-Table -Property Name, IngestionMode, WorkspaceResourceId, @{label='Type';expression={if ($_.ingestionMode -eq 'LogAnalytics') {'Workspace-based'} elseif ($_.IngestionMode -eq 'ApplicatonInsights') {'Classic'}}}
134+
135+
```
168136

169137
## Programmatic resource migration
170138

0 commit comments

Comments
 (0)