---
title: "Azure Monitoring and Alerts Basicを使った新しいSitecoreインスタンスをAzureにデプロイする"
slug: "deploy-a-new-sitecore-instance-on-azure-with-azure-monitoring-and-alerts-basic"
abstract: "AzureでSitecoreをデプロイする際、AzureモニタリングとアラートBasicでアプリのパフォーマンスを特定し、測定し、評価しましょう。"
---
# Azure Monitoring and Alerts Basicを使った新しいSitecoreインスタンスをAzureにデプロイする

Azure Monitoring and Alerts Basicモジュールは、Azure Monitorを使って特定のリソースが許容範囲内で動作しているかどうかを追跡します。Azure Monitorは、ログ分析とアプリケーションインサイトを組み合わせてテレメトリを収集・分析し、アプリケーションの性能をよりよく理解し、パフォーマンスを最大化するツールです。異なる種類のリソースには、異なる閾値やチェックすべき時間帯があります。デフォルトでは、Azure Monitoring and Alerts Basicは各Sitecoreトポロジーごとに特定のアラートを作成しています。

## 前提条件

AzureモニタリングとアラートベーシックでAzureにSitecore環境を展開する前に、以下の条件を満たす必要があります:

-   [Sitecore Azureツールキットで始める](https://doc.sitecore.com/xp/en/developers/sat/22/sitecore-azure-toolkit/en/getting-started-with-the-sitecore-azure-toolkit.html)方法を進めてください。
    
-   [Azure App Serviceに新しいSitecore環境をデプロイ](https://doc.sitecore.com/xp/en/developers/sat/22/sitecore-azure-toolkit/en/deploy-a-new-sitecore-environment-to-azure-app-service.html)する作業を進めてください。特に以下のセクションを進めてください:
    
    -   *環境を計画しましょう*
    -   *WebDeployパッケージの準備*
    -   *環境テンプレートをダウンロードして設定する*
-   最新バージョンのPowerShell(最低6.0.0)をインストールする – PowerShellモジュールをアップグレードするには、以下を実行します:
    
    Update-Module -Name AzureRM -RequiredVersion 6.0.0 -Force
    

## Azure Monitoring and Alerts Basicモジュールを追加してください

Azure Monitoring and Alerts Basicモジュールを追加するには、特定のトポロジーのparameters.jsonファイルに注入する必要があります。モジュールをparameters.jsonファイルに注入するには:

1.  [Sitecore環境](https://doc.sitecore.com/xp/en/developers/sat/22/sitecore-azure-toolkit/en/deploy-a-new-sitecore-environment-to-azure-app-service.html)に対応できるparameters.jsonファイルを用意してください。
2.  parameters.jsonファイルでmodulesパラメータを追加してください。
3.  また、Sitecore設定の parameters.json ファイルに、 *Monitoring* モジュールの設定スニペットを modules パラメータに挿入してください。次のセクションのスニペットを使いましょう: *モニタリングモジュールの設定*。

## モニタリングモジュールの設定

AzureモニタリングおよびアラートBasicモジュールのSitecore環境展開への統合のために、

1.  azuredeploy.parameters.jsonファイルで、modulesパラメータに以下のスニペットを追加します。
    
    {… ,
     "modules": {
     "value": {
     "items": 
     {
     "name": "monitoring",
     "templateLink": "<url of Azure Monitoring and Alerts Basic azuredeploy.json>",
     "parameters": {
     "omsWorkspaceMetricsRetentionDays": <days>,
     "omsWorkspaceAlertRecipients": "<email address for alert recipient>",
     "omsWorkspaceLocation": "<Australia Southeast or Canada Central or Central India or East US or Japan East or Southeast Asia or UK South or West Europe>",
     "applicationInsightsLocation": "<location>"
    
     }
     }
     
     }
     }
    }
    
2.  Azure Monitoring and Alerts Basicモジュールのパラメータを入力してください。
    
    パラメータ
    
    指示
    
    templateLink
    
    Githubでは、 *Monitoring*モジュールにアクセスし、Azureモニタリングおよびアラート基本テンプレートのURLを azuredeploy.json。または、 [Azureのモニタリングおよびアラート基本ARMテンプレートをダウンロード](https://github.com/Sitecore/Sitecore-Azure-Quickstart-Templates) してストレージアカウントにアップロードすることもできます。
    
    OmsWorkspaceMetricsRetentionDays
    
    カスタム指標の保持日数を入力してください。日数の値は 30 から 730の間です。
    
    OmsWorkspaceAlertRecipients
    
    アラートを受け取るには、メールアドレスを入力してください。複数のメールアドレスを使いたい場合は、セミコロン「;」で区切り符を付けてください。
    
    OmsWorkspaceLocation
    
    OMSをプロビジョニングしたい場所を指定します。現在利用可能な場所は以下の通りです: Australia Southeast、 Canada Central、 Central India、 East US、 Japan East、 Southeast Asia、 UK South、 West Europe。
    
    applicationInsightsLocation
    
    Application Insightsをプロビジョニングしたい場所を指定します。現在利用可能な場所は以下の通りです: East US、 North Europe、 Southeast Asia、 South Central US、 West Europe、 West US 2。
    

## デプロイコマンドを呼び出す

PowerShellデプロイコマンドを呼び出してプロビジョニングを開始するには:

1.  **PowerShell**で**Azure Toolkit**フォルダを開き、Azure Toolkitモジュール「**Import-Module**.\\tools\\Sitecore.Cloud.Cmdlets.psm1-Verbose」を読み込みます。
    
2.  コマンドAdd-AzureRMAccountを使って、PowerShellセッションにAzureアカウントを追加します。
    
3.  複数のサブスクリプションにアクセスできる場合は、展開したいサブスクリプションを選択します。例えば: Set-AzureRMContext -SubscriptionName "<name of your subscription>"。
    
4.  プロビジョニングを開始するには、Start-SitecoreAzureDeploymentコマンドレットを使用します:
    
    Start-SitecoreAzureDeployment -location <String> -Name <String> -ArmTemplateUrl <String> -ArmParametersPath <String> -LicenseXmlPath <String> -SetKeyValue <Hashtable>
    
    Start-SitecoreAzureDeploymentコマンドレットは以下のパラメータを使用します:
    
    -   パラメータ:説明
    -   Locationリソースを展開したいAzureデータセンター。[Azureデータセンター互換性表](https://kb.sitecore.net/articles/617478)には、Sitecore Experience Platformが展開をサポートするMicrosoft Azureデータセンターが一覧化されています。
    -   Name: 新しい環境のリソースグループ名。名前は新しいリソースグループまたは既存のリソースグループを指すことがあり、通常はデプロイメントIDと同じです。
    -   ArmTemplateUrl: 展開したい環境構成のARMテンプレートファイルのURLです。
    -   ArmParametersPath: 選択したテンプレートの埋め込まれたparameters.jsonファイルへのローカルパスです。
    -   LicenseXmlPath:環境にデプロイしたいSitecoreライセンスファイルへのパス。
    -   SetKeyValue:(任意)このパラメータをスクリプトで使用して複数の環境を展開:azuredeploy.parameters.jsonファイル内の共通のデフォルトパラメータ値のセットを使用します。コマンドラインで環境固有のパラメータ値を提供します。このパラメータの値は、azuredeploy.parameters.jsonファイルで記述されたパラメータのサブセットを含むハッシュテーブルです。このパラメータに対してコマンドラインで指定した値は、azuredeploy.parameters.jsonファイルの値を上書きします。例えば、deploymentIdparameterの値を設定またはオーバーライドするには、以下を入力してください。
    
    \-SetKeyValue @{ "deploymentId" = "<new value>" }
    

### 展開例

以下のPowerShellスクリプトは、Sitecore Azure Toolkitを使ってAzureモニタリングおよびアラートベーシックモジュールでSitecoreをAzureにデプロイする方法を示しています。

# Deployment joson file path
$ArmTemplateUrl = "<azuredeploy.json URI>"

# Azure template parameters path
$ArmParametersPath = "<Local Path for \*.parameters.json>"

# Sitecore Azure toolkit Path
$SCSDK = "<Directory path to Azure Toolkit>"

# Name of resource group
$Name = "< Resource group name>"

# Sitecore License File
$LicenseFile = "< LicenseFile >"

#Azure Subscriptionid
$SubscriptionId = "< AzureSubscriptionId >"

# Location of deployment
$Region = "< Location of deployment >"

# Import Sitecore SDK module
Import-Module $SCSDK\\Sitecore.Cloud.Cmdlets.psm1

# Select Azure Account
Add-AzureRMAccount
Set-AzureRMContext -SubscriptionId $SubscriptionId

# Deploy Sitecore
Start-SitecoreAzureDeployment -Name $Name -Region $Region -ArmTemplateUrl $ArmTemplateUrl -ArmParametersPath $ArmParametersPath -LicenseXmlPath $LicenseFile

## SitecoreからAzure Monitorを除去する

モニターが不要Azure Azure場合は削除できます。

> !重要Azure Monitorリソースグループだけを削除したい場合は、そのリソースグループを削除しないでください。そうしないとSitecoreも同時に削除されます。その場合は [、デプロイコマンドを呼び出し](https://doc.sitecore.com/xp/ja/developers/91/sitecore-experience-manager/deploy-a-new-sitecore-instance-on-azure-with-azure-monitoring-and-alerts-basic.html#UUID-fe6c96ba-e261-59eb-79f7-c89af223ed08_section-idm46026195801120 "Invoke the deployment command") てSitecoreを再デプロイできます。

Application Insightsリソースグループを削除するには:

1.  Microsoft Azureポータルで **「リソースグループ** 」をクリックすると、利用可能なすべてのリソースグループが表示されます。
    
2.  展開済みリソースグループをクリックすると、そのグループで利用可能なすべてのリソースが表示され、**その後概要**で **「アプリケーションインサイト**」を選択します。
    
    ![The Azure resource group Application Insights.](https://doc.sitecore.com/api/markdown-image/xp/ja/developers/91/sitecore-experience-manager/images/AzureResourceGroup_AppInsights.png)
    
3.  左側のメニューで **「利用可能性**」をクリックし、「 **詳細** 」をクリックすると、すべての*Tier 4*アラート、*Availability test*アラート、または*Ping test*アラートが表示されます。
    
4.  削除したいテストの右側にある **「利用可能なテスト概要**」で、(**...**)をクリックし、「 **削除」をクリックしてください**。
    
    ![Delete the Availability test.](https://doc.sitecore.com/api/markdown-image/xp/ja/developers/91/sitecore-experience-manager/images/Delete_availability_test.png)
    

関連する指標アラートを削除するには:

1.  Microsoft Azureポータルで **「モニター**」をクリックし、次に **「アラート」**を選択します。
    
    ![Click Manage alerts rules.](https://doc.sitecore.com/api/markdown-image/xp/ja/developers/91/sitecore-experience-manager/images/Monitor_overview.png)
    
2.  **「アラートルール管理**」をクリックし、適切なサブスクリプションおよびリソースグループを選択すると、すべての*Tier 1*、*Tier 2*、*Tier 3*メトリックアラートが表示されます。
    
    ![See the Tier metric alerts.](https://doc.sitecore.com/api/markdown-image/xp/ja/developers/91/sitecore-experience-manager/images/SeeTheTierMetricAlerts.png)
    
3.  削除したい指標アラートの横にあるチェックボックスを選択し、「 **削除**」をクリックします。
    
    ![Delete a monitor metric alert.](https://doc.sitecore.com/api/markdown-image/xp/ja/developers/91/sitecore-experience-manager/images/DeleteMonitorMetricAlert.png)