Files
81b83f8618 [AutoPR @azure-arm-alertprocessingrules]-generated-from-SDK Generation - JS-6191237 (#38241)
Configurations:
'specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/AlertProcessingRules/tspconfig.yaml',
API Version: 2021-08-08, SDK Release Type: beta, and CommitSHA:
'4850dea187a72ae7ceaf0bd61b2e4a4c4b4a3b3e' in SpecRepo:
'https://github.com/Azure/azure-rest-api-specs' Pipeline run:
https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6191237
Refer to
https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites
to prepare for SDK release.

---------

Co-authored-by: Jiao Di (MSFT) <[email protected]>
2026-04-23 22:09:08 +08:00

5.3 KiB

@azure/arm-alertprocessingrules client library samples for JavaScript (Beta)

These sample programs show how to use the JavaScript client libraries for @azure/arm-alertprocessingrules in some common scenarios.

File Name Description
alertProcessingRulesCreateOrUpdateSample.js create or update an alert processing rule. x-ms-original-file: 2021-08-08/AlertProcessingRules_Create_or_update_add_action_group_all_alerts_in_subscription.json
alertProcessingRulesDeleteSample.js delete an alert processing rule. x-ms-original-file: 2021-08-08/AlertProcessingRules_Delete.json
alertProcessingRulesGetByNameSample.js get an alert processing rule by name. x-ms-original-file: 2021-08-08/AlertProcessingRules_GetById.json
alertProcessingRulesListByResourceGroupSample.js list all alert processing rules in a resource group. x-ms-original-file: 2021-08-08/AlertProcessingRules_List_ResourceGroup.json
alertProcessingRulesListBySubscriptionSample.js list all alert processing rules in a subscription. x-ms-original-file: 2021-08-08/AlertProcessingRules_List_Subscription.json
alertProcessingRulesUpdateSample.js enable, disable, or update tags for an alert processing rule. x-ms-original-file: 2021-08-08/AlertProcessingRules_Patch.json

Prerequisites

The sample programs are compatible with LTS versions of Node.js.

You need an Azure subscription to run these sample programs.

Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function.

Adapting the samples to run in the browser may require some additional consideration. For details, please see the package README.

Setup

To run the samples using the published version of the package:

  1. Install the dependencies using npm:
npm install
  1. Edit the file sample.env, adding the correct credentials to access the Azure service and run the samples. Then rename the file from sample.env to just .env. The sample programs will read this file automatically.

  2. Run whichever samples you like (note that some samples may require additional setup, see the table above):

node alertProcessingRulesCreateOrUpdateSample.js

Alternatively, run a single sample with the required environment variables set (setting up the .env file is not required if you do this), for example (cross-platform):

node alertProcessingRulesCreateOrUpdateSample.js

Next Steps

Take a look at our API Documentation for more information about the APIs that are available in the clients.