Skip to content

Commit 607cf9f

Browse files
authored
Update deploy-sap-btp-solution.md
1 parent 06025f6 commit 607cf9f

File tree

1 file changed

+57
-8
lines changed

1 file changed

+57
-8
lines changed

articles/sentinel/sap/deploy-sap-btp-solution.md

Lines changed: 57 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@ Before you begin, verify that:
2525
- Your organization uses SAP BTP (in a Cloud Foundry environment) to streamline interactions with SAP applications and other business applications.
2626
- You have an SAP BTP account (which supports BTP accounts in the Cloud Foundry environment). You can also use a [SAP BTP trial account](https://cockpit.hanatrial.ondemand.com/).
2727
- You have the SAP BTP auditlog-management service and service key (see [Set up the BTP account and solution](#set-up-the-btp-account-and-solution)).
28-
- You can create an [Azure function app](../../azure-functions/functions-overview.md) by using the Microsoft.Web/Sites, Microsoft.Web/ServerFarms, Microsoft.Insights/Components, and Microsoft.Storage/StorageAccounts permissions.
29-
- You can create [data collection rules and endpoints](../../azure-monitor/essentials/data-collection-rule-overview.md) by using these permissions:
30-
- Microsoft.Insights/DataCollectionEndpoints and Microsoft.Insights/DataCollectionRules.
31-
- Assign the Monitoring Metrics Publisher role to the function app.
32-
- You have an [Azure Key Vault](../../key-vault/general/overview.md) to hold the SAP BTP client secret.
28+
- You have the Sentinel Contributor role on the target Sentinel workspace.
3329

3430
## Set up the BTP account and solution
3531

@@ -69,14 +65,14 @@ To set up the BTP account and the solution:
6965
1. Select the resource group and the Microsoft Sentinel workspace in which to deploy the solution.
7066
1. Select **Next** until you pass validation, and then select **Create**.
7167
1. When the solution deployment is finished, return to your Microsoft Sentinel workspace and select **Data connectors**.
72-
1. In the search bar, enter **BTP**, and then select **SAP BTP (using Azure Function)**.
68+
1. In the search bar, enter **BTP**, and then select **SAP BTP**.
7369
1. Select **Open connector page**.
74-
1. On the connector page, make sure that you meet the required prerequisites and complete the configuration steps. In step 2 of the data connector configuration, specify the parameters that you defined in step 4 in this section.
70+
1. On the connector page, make sure that you meet the required prerequisites and complete the configuration steps. Click **Add account**.
71+
1. Specify the parameters that you defined in step 4 in this section. The subaccount name specified will be projected as a column in the SAPBTPAuditLog_CL table. This can be used to filter the logs when adding multiple subaccounts.
7572

7673
> [!NOTE]
7774
> Retrieving audits for the global account doesn't automatically retrieve audits for the subaccount. Follow the connector configuration steps for each of the subaccounts you want to monitor, and also follow these steps for the global account. Review these [account auditing configuration considerations](#consider-your-account-auditing-configurations).
7875
79-
1. Complete all configuration steps, including the function app deployment and the Azure Key Vault access policy configuration.
8076
1. Make sure that BTP logs are flowing into the Microsoft Sentinel workspace:
8177

8278
1. Sign in to your BTP subaccount and run a few activities that generate logs, such as sign-ins, adding users, changing permissions, and changing settings.
@@ -105,6 +101,59 @@ You also can retrieve the logs via the UI:
105101
1. In the new instance, create a service key.
106102
1. View the service key and retrieve the required parameters from step 4 of the configuration instructions in the data connector UI (**url**, **uaa.url**, **uaa.clientid**, and **uaa.clientsecret**).
107103

104+
## Rotating the BTP client secret
105+
106+
It is recommended to periodically rotate the client secrets of the BTP subaccounts. The following example script can be used to demonstrate the process of updating a data connector. The script will fetch the secret from Azure Key Vault and update the existing data connector with a new secret.
107+
108+
1. Collect the required parameters for the script, subscription id, resource group and workspace name of the Sentinel workspace. The key vault and name of the key vault secret, and the name of the data connector to update.
109+
110+
> [!NOTE]
111+
> Identify the name of the data connector by opening the SAP BTP data connector in data connectors blade. It should look like "BTP_{connector name}".
112+
113+
```powershell
114+
param(
115+
[Parameter(Mandatory = $true)] [string]$subscriptionId,
116+
[Parameter(Mandatory = $true)] [string]$workspaceName,
117+
[Parameter(Mandatory = $true)] [string]$resourceGroupName,
118+
[Parameter(Mandatory = $true)] [string]$connectorName,
119+
[Parameter(Mandatory = $true)] [string]$clientId,
120+
[Parameter(Mandatory = $true)] [string]$keyVaultName,
121+
[Parameter(Mandatory = $true)] [string]$secretName
122+
)
123+
124+
# Import the required modules
125+
Import-Module Az.Accounts
126+
Import-Module Az.KeyVault
127+
128+
try {
129+
# Login to Azure
130+
Login-AzAccount
131+
132+
# Retrieve BTP client secret from Key Vault
133+
$clientSecret = (Get-AzKeyVaultSecret -VaultName $keyVaultName -Name $secretName).SecretValue
134+
if (!($clientSecret)) {
135+
throw "Failed to retrieve the client secret from Azure Key Vault"
136+
}
137+
138+
# Get the connector from data connectors API
139+
$path = "/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.OperationalInsights/workspaces/{2}/providers/Microsoft.SecurityInsights/dataConnectors/{3}?api-version=2024-01-01-preview" -f $subscriptionId, $resourceGroupName, $workspaceName, $connectorName
140+
$connector = (Invoke-AzRestMethod -Path $path -Method GET).Content | ConvertFrom-Json
141+
if (!($connector)) {
142+
throw "Failed to retrieve the connector"
143+
}
144+
145+
# Add the updated client ID and client secret to the connector
146+
$connector.properties.auth | Add-Member -Type NoteProperty -Name "clientId" -Value $clientId
147+
$connector.properties.auth | Add-Member -Type NoteProperty -Name "clientSecret" -Value ($clientSecret | ConvertFrom-SecureString -AsPlainText)
148+
149+
# Update the connector with the new auth object
150+
Invoke-AzRestMethod -Path $path -Method PUT -Payload ($connector | ConvertTo-Json -Depth 10)
151+
}
152+
catch {
153+
Write-Error "An error occurred: $_"
154+
}
155+
```
156+
108157
## Related content
109158

110159
- [Learn how to enable the security content](../sentinel-solutions-deploy.md#analytics-rule)

0 commit comments

Comments
 (0)