Quickstart: deploy Azure Monitor for SAP solutions with PowerShell (preview)

Important

Azure Monitor for SAP solutions is currently in PREVIEW. See the Supplemental Terms of Use for Microsoft Azure Previews for legal terms that apply to Azure features that are in beta, preview, or otherwise not yet released into general availability.

Get started with Azure Monitor for SAP solutions (AMS) by using the Az.HanaOnAzure PowerShell module to create AMS resources. You'll create a resource group, set up monitoring, and create a provider instance.

This content only applies to the AMS (classic) version of the service.

Prerequisites

  • If you don't have an Azure subscription, create a free account before you begin.

  • If you choose to use PowerShell locally, this article requires that you install the Az PowerShell module. You'll also need to connect to your Azure account using the Connect-AzAccount cmdlet. For more information about installing the Az PowerShell module, see Install Azure PowerShell. Alternately, you can use Azure Cloud Shell.

  • While the Az.HanaOnAzure PowerShell module is in preview, you must install it separately using the Install-Module cmdlet. Once this PowerShell module becomes generally available, it becomes part of future Az PowerShell module releases and available natively from within Azure Cloud Shell.

    Install-Module -Name Az.HanaOnAzure
    
  • If you have multiple Azure subscriptions, choose the appropriate subscription in which the resources should be billed. Select a specific subscription using the Set-AzContext cmdlet.

    Set-AzContext -SubscriptionId 00000000-0000-0000-0000-000000000000
    

Create a resource group

Create an Azure resource group by using the New-AzResourceGroup cmdlet. A resource group is a logical container in which Azure resources are deployed and managed as a group.

The following example creates a resource group with the specified name and in the specified location.

New-AzResourceGroup -Name myResourceGroup -Location westus2

SAP monitor

To create an SAP monitor, use the New-AzSapMonitor cmdlet. The following example creates an SAP monitor for the specified subscription, resource group, and resource name.

$Workspace = New-AzOperationalInsightsWorkspace -ResourceGroupName myResourceGroup -Name sapmonitor-test -Location westus2 -Sku Standard

$WorkspaceKey = Get-AzOperationalInsightsWorkspaceSharedKey -ResourceGroupName myResourceGroup -Name sapmonitor-test

$SapMonitorParams = @{
  Name = 'ps-sapmonitor-t01'
  ResourceGroupName = 'myResourceGroup'
  Location = 'westus2'
  EnableCustomerAnalytic = $true
  MonitorSubnet = '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet-sap/subnets/mysubnet'
  LogAnalyticsWorkspaceSharedKey = $WorkspaceKey.PrimarySharedKey
  LogAnalyticsWorkspaceId = $Workspace.CustomerId
  LogAnalyticsWorkspaceResourceId = $Workspace.ResourceId
}
New-AzSapMonitor @SapMonitorParams

To retrieve the properties of an SAP monitor, use the Get-AzSapMonitor cmdlet. The following example gets properties of an SAP monitor for the specified subscription, resource group, and resource name.

Get-AzSapMonitor -ResourceGroupName myResourceGroup -Name ps-spamonitor-t01

Provider instance

To create a provider instance, use the New-AzSapMonitorProviderInstance cmdlet. The following example creates a provider instance for the specified subscription, resource group, and resource name.

$SapProviderParams = @{
  ResourceGroupName = 'myResourceGroup'
  Name = 'ps-sapmonitorins-t01'
  SapMonitorName = 'yemingmonitor'
  ProviderType = 'SapHana'
  HanaHostname = 'hdb1-0'
  HanaDatabaseName = 'SYSTEMDB'
  HanaDatabaseSqlPort = '30015'
  HanaDatabaseUsername = 'SYSTEM'
  HanaDatabasePassword = (ConvertTo-SecureString 'Manager1' -AsPlainText -Force)
}
New-AzSapMonitorProviderInstance @SapProviderParams

To retrieve properties of a provider instance, use the Get-AzSapMonitorProviderInstance cmdlet. The following example gets properties of:

  • A provider instance for the specified subscription
  • The resource group
  • The SapMonitor name
  • The resource name
Get-AzSapMonitorProviderInstance -ResourceGroupName myResourceGroup -SapMonitorName ps-spamonitor-t01

Clean up resources

If the resources created in this article aren't needed, you can delete them by running the following examples.

Delete the provider instance

To remove a provider instance, use the Remove-AzSapMonitorProviderInstance cmdlet. The following example deletes a provider instance for the specified subscription, resource group, SapMonitor name, and resource name.

Remove-AzSapMonitorProviderInstance -ResourceGroupName myResourceGroup -SapMonitorName ps-spamonitor-t01 -Name ps-sapmonitorins-t02

Delete the SAP monitor

To remove an SAP monitor, use the Remove-AzSapMonitor cmdlet. The following example deletes an SAP monitor for the specified subscription, resource group, and monitor name.

Remove-AzSapMonitor -ResourceGroupName myResourceGroup -Name ps-sapmonitor-t02

Delete the resource group

Caution

The following example deletes the specified resource group and all resources contained within it. If resources outside the scope of this article exist in the specified resource group, they will also be deleted.

Remove-AzResourceGroup -Name myResourceGroup

Next steps

Learn more about Azure Monitor for SAP solutions.