A utility to check the amount of async operations waiting in Microsoft Dataverse (formerly Dynamics 365/CRM) and alert if they are above a limit.
- .NET 8.0 SDK or later
- Access to a Microsoft Dataverse environment
- SMTP server credentials for email notifications
To build the project, run:
dotnet build CRMAsyncHealthChecker.slnOr to build in Release mode:
dotnet build CRMAsyncHealthChecker.sln --configuration ReleaseTo run the test suite:
dotnet test CRMAsyncHealthChecker.slnThe application requires a JSON configuration file with the following structure:
{
"EnvironmentName": "Production",
"ConnectionString": "AuthType=OAuth;Username=user@contoso.onmicrosoft.com;Password=password;Url=https://contoso.crm.dynamics.com;AppId=51f81489-12ee-4a9e-aaae-a2591f45987d;RedirectUri=app://58145B91-0C36-4500-8554-080854F2AC97;LoginPrompt=Auto",
"EmailServerAddress": "smtp.office365.com",
"EmailServerPort": 587,
"EmailServerUsername": "alerts@contoso.com",
"EmailServerPassword": "email-password",
"FromAddress": "alerts@contoso.com",
"ToAddress": [
"admin@contoso.com",
"support@contoso.com"
],
"Limit": 1000
}- EnvironmentName: A friendly name for the environment (used in email subject)
- ConnectionString: Dataverse connection string (see connection string documentation)
- EmailServerAddress: SMTP server hostname
- EmailServerPort: SMTP server port (typically 587 for TLS or 25)
- EmailServerUsername: SMTP authentication username
- EmailServerPassword: SMTP authentication password
- FromAddress: Email address to send alerts from
- ToAddress: Array of email addresses to receive alerts
- Limit: Number of waiting async operations that triggers an alert
Run the application with a configuration file:
dotnet run --project CRMAsyncHealthChecker/CRMAsyncHealthChecker.csproj -- /path/to/config.jsonOr after building, run the executable directly:
# Windows
CRMAsyncHealthChecker\bin\Release\net8.0\CRMAsyncHealthChecker.exe config.json
# Linux/macOS
./CRMAsyncHealthChecker/bin/Release/net8.0/CRMAsyncHealthChecker config.json- Connects to the specified Dataverse environment using the provided connection string
- Queries for async operations with a status of "Waiting" (statuscode = 0)
- If the count is greater than or equal to the configured limit, sends an email alert
- Email includes the environment name and the configured limit
See LICENSE file for details.