Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved guidance on how to setup Usage Reporting when using ASB #6937

Merged
merged 3 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions servicecontrol/servicecontrol-instances/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,8 @@ If using [MSMQ transport](/transports/msmq) and the monitoring instance is insta

## Usage Reporting when using the Azure Service Bus transport

The following settings are part of [Usage Reporting Setup when using the Azure Service Bus transport](/servicepulse/usage-config#connection-setup-azure-service-bus

### LicensingComponent/ASB/ServiceBusName

Version: 5.4.0+
Expand Down
46 changes: 44 additions & 2 deletions servicepulse/usage-config.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Usage Setup
title: Usage Reporting Setup
summary: Viewing endpoint usage summary and generating a usage report
component: ServicePulse
reviewed: 2024-05-08
Expand All @@ -25,13 +25,54 @@ Look at the [Diagnostics](#diagnostics) tab to diagnose connection issues.

### Azure Service Bus

Steps:

1. Create an application Id for ServiceControl
2. Assign the role `Monitoring Reader` to this application Id
3. Update ServiceControl configuration and set at minimum `TenantId`, `SubscriptionId`, `ClientId` (aka ApplicationId) and its accompanying `ClientSecret`

#### Using Azure Portal

- Create App
-* *Home > App registrations** > ➕ New registration
- Assign application to role:
- **Home > Service Bus > {service bus namespace} > Access control (IAM) > ➕ Add
- Role: `Monitoring Reader`
- Members: ➕ Select Members > {application name}
- Review and Assign


#### Setup using Azure CLI

```ps1
# set correct context and subscription
az account set --subscription "YourAzureSubscriptionName"
Set-AzContext -Subscription "YourAzureSubscriptionName"

# Application ID: az ad app create --display-name ServiceControlUsageReporting
$applicationId = "817c7efc-0c93-473a-99b9-1612d32b8678"
ramonsmits marked this conversation as resolved.
Show resolved Hide resolved

# Azure Service Bus subscription ID: az servicebus namespace list
$subscriptionId = "934f5a76-bd9e-4d9a-be26-94b1476bab33"
ramonsmits marked this conversation as resolved.
Show resolved Hide resolved

# Resource group name: az group list
$resourceGroupName = "ramon.smits"
ramonsmits marked this conversation as resolved.
Show resolved Hide resolved
# Assign role to resource group

$scope = "/subscriptions/$subscriptionId/resourceGroups/$resourceGroupName"
# or to specific resource in resource group
#$scope = "/subscriptions/$subscriptionId/resourceGroups/$resourceGroupName/providers/Microsoft.ServiceBus/namespaces/$namespaceName

New-AzRoleAssignment -ApplicationId $applicationId -RoleDefinitionName "Monitoring Reader" -Scope $scope
```

#### Settings

Refer to the [Usage Reporting when using the Azure Service Bus transport](/servicecontrol/servicecontrol-instances/configuration.md#usage-reporting-when-using-the-azure-service-bus-transport) section of the ServiceControl config file for an explanation of the Azure Service Bus-specific settings.

#### Minimum Permissions

The built-in role [Monitoring Reader](https://learn.microsoft.com/en-us/azure/azure-monitor/roles-permissions-security#monitoring-reader) is sufficient to access the required Azure Service Bus metrics.
The built-in role [`Monitoring Reader`](https://learn.microsoft.com/en-us/azure/azure-monitor/roles-permissions-security#monitoring-reader) is sufficient to access the required Azure Service Bus metrics.

To lock it down even further to the minimally required permissions, create a custom role with the following permissions:

Expand Down Expand Up @@ -61,6 +102,7 @@ To lock it down even further to the minimally required permissions, create a cus
}
```


The `Microsoft.ServiceBus` permissions are required to read queue names and metric data from Azure Monitor. The `Microsoft.Resources/subscriptions` permissions are required in order to locate the Service Bus namespace within the Azure subscription.

### Amazon SQS
Expand Down
Loading