可用性テストを移行する

この記事では、従来の URL ping テストから最新かつ効率的な標準テストに移行するプロセスについて説明します。

シームレスな移行を確実にし、最新の監視機能をアプリケーションに提供するための明確かつ詳細な手順を提供することで、このプロセスを簡略化します。

従来の URL ping テストを標準テストに移行する

次の手順では、URL ping テストの機能をレプリケートする標準テストの作成プロセスについて説明します。 これにより、以前作成した URL ping テストを使用して、標準テストの高度な機能をより簡単に利用し始めることができます。

重要

2026 年 9 月 30 日に、 URL ping テスト は廃止されます。 それまでに、標準テストに移行してください。

  • コストは、標準テストの実行に関連付けられます。 標準テストを作成すると、テストの実行に対して課金されます。

  • このプロセスを開始する前に、Azure Monitor の価格に関するページを参照してください。

必須コンポーネント

手順

  1. Azure PowerShell (Connect-AzAccount + Set-AzContext) を使用してサブスクリプションに接続します。

  2. 現在のサブスクリプションのすべての URL ping テストを一覧表示してください。

    Get-AzApplicationInsightsWebTest | `
    Where-Object { $_.WebTestKind -eq "ping" } | `
    Format-Table -Property ResourceGroupName,Name,WebTestKind,Enabled;
    
  3. 移行したい URL ping テストを見つけて、そのリソース グループと名前を記録してください。

  4. 次のコマンドで、URL ping テストと同じロジックの標準テストを作成します。

    $resourceGroup = "pingTestResourceGroup";
    $appInsightsComponent = "componentName";
    $pingTestName = "pingTestName";
    $newStandardTestName = "newStandardTestName";
    
    $componentId = (Get-AzApplicationInsights -ResourceGroupName $resourceGroup -Name $appInsightsComponent).Id;
    $pingTest = Get-AzApplicationInsightsWebTest -ResourceGroupName $resourceGroup -Name $pingTestName;
    $pingTestRequest = ([xml]$pingTest.ConfigurationWebTest).WebTest.Items.Request;
    $pingTestValidationRule = ([xml]$pingTest.ConfigurationWebTest).WebTest.ValidationRules.ValidationRule;
    
    $dynamicParameters = @{};
    
    if ($pingTestRequest.IgnoreHttpStatusCode -eq [bool]::FalseString) {
    $dynamicParameters["RuleExpectedHttpStatusCode"] = [convert]::ToInt32($pingTestRequest.ExpectedHttpStatusCode, 10);
    }
    
    if ($pingTestValidationRule -and $pingTestValidationRule.DisplayName -eq "Find Text" `
    -and $pingTestValidationRule.RuleParameters.RuleParameter[0].Name -eq "FindText" `
    -and $pingTestValidationRule.RuleParameters.RuleParameter[0].Value) {
    $dynamicParameters["ContentMatch"] = $pingTestValidationRule.RuleParameters.RuleParameter[0].Value;
    $dynamicParameters["ContentPassIfTextFound"] = $true;
    }
    
    New-AzApplicationInsightsWebTest @dynamicParameters -ResourceGroupName $resourceGroup -Name $newStandardTestName `
    -Location $pingTest.Location -Kind 'standard' -Tag @{ "hidden-link:$componentId" = "Resource" } -TestName $newStandardTestName `
    -RequestUrl $pingTestRequest.Url -RequestHttpVerb "GET" -GeoLocation $pingTest.PropertiesLocations -Frequency $pingTest.Frequency `
    -Timeout $pingTest.Timeout -RetryEnabled:$pingTest.RetryEnabled -Enabled:$pingTest.Enabled `
    -RequestParseDependent:($pingTestRequest.ParseDependentRequests -eq [bool]::TrueString);
    
  5. 新しい標準テストには既定でアラート ルールがないため、わずらわしいアラートは作成されません。 URL ping テストは変更されないため、これについては引き続きアラートを利用できます。

  6. 新しい標準テストの機能を確認したら、URL ping テストを参照するアラート ルールを更新して、代わりに標準テストを参照するようにします。 次に、URL ping テストを無効化または削除します。

  7. Azure PowerShell を使用して URL ping テストを削除する場合は、次のコマンドを使用できます。

    Remove-AzApplicationInsightsWebTest -ResourceGroupName $resourceGroup -Name $pingTestName;
    

よく寄せられる質問

どのような場合にこれらのコマンドを使用すべきですか?

新しい機能を活用するために、今すぐ URL ping テストを標準テストに移行してください。

これらの手順は、HTTP エンドポイントと HTTPS エンドポイントの両方で機能しますか?

はい。これらのコマンドは、URL ping テストで使用される HTTP エンドポイントと HTTPS エンドポイントの両方で機能します。

詳細情報