@azure/ai-anomaly-detector v3.0.0-beta.5
Azure Anomaly Detector client library for JavaScript
Azure AnomalyDetector API enables you to monitor and detect abnormalities in your time series data with machine learning.
Source code | Package (NPM) | API reference documentation | Product documentation |Samples Samples
Key concepts
Coming soon (#10865)
Getting started
Currently supported environments
- Node.js version 8.x.x or higher
Prerequisites
- An Azure subscription.
- An existing Cognitive Services or Anomaly Detector resource. If you need to create the resource, you can use the Azure Portal or Azure CLI.
If you use the Azure CLI, replace <your-resource-group-name>
and <your-resource-name>
with your own unique names:
az cognitiveservices account create --kind AnomalyDetector --resource-group <your-resource-group-name> --name <your-resource-name>
Install the @azure/ai-anomaly-detector
package
Install the Azure Anomaly Detector client library for JavaScript with npm
:
npm install @azure/ai-anomaly-detector
Create and authenticate a AnomalyDetectorClient
To create a client object to access the Anomaly Detector API, you will need the endpoint
of your Anomaly Detector resource and a credential
. The Anomaly Detector client can use either Azure Active Directory credentials or an API key credential to authenticate.
You can find the endpoint for your Anomaly Detector resource either in the Azure Portal or by using the Azure CLI snippet below:
az cognitiveservices account show --name <your-resource-name> --resource-group <your-resource-group-name> --query "endpoint"
Using an API Key
Use the Azure Portal to browse to your Anomaly Detector resource and retrieve an API key, or use the Azure CLI snippet below:
Note: Sometimes the API key is referred to as a "subscription key" or "subscription API key."
az cognitiveservices account keys list --resource-group <your-resource-group-name> --name <your-resource-name>
Once you have an API key and endpoint, you can use the AzureKeyCredential
class to authenticate the client as follows:
const { AnomalyDetectorClient, AzureKeyCredential } = require("@azure/ai-anomaly-detector");
const client = new AnomalyDetectorClient("<endpoint>", new AzureKeyCredential("<API key>"));
Using an Azure Active Directory Credential
Client API key authentication is used in most of the examples, but you can also authenticate with Azure Active Directory using the Azure Identity library. To use the DefaultAzureCredential provider shown below,
or other credential providers provided with the Azure SDK, please install the @azure/identity
package:
npm install @azure/identity
You will also need to register a new AAD application and grant access to Anomaly Detector by assigning the "Cognitive Services User"
role to your service principal (note: other roles such as "Owner"
will not grant the necessary permissions, only "Cognitive Services User"
will suffice to run the examples and the sample code).
Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: AZURE_CLIENT_ID
, AZURE_TENANT_ID
, AZURE_CLIENT_SECRET
.
const { AnomalyDetectorClient } = require("@azure/ai-anomaly-detector");
const { DefaultAzureCredential } = require("@azure/identity");
const client = new AnomalyDetectorClient("<endpoint>", new DefaultAzureCredential());
Examples
Coming soon (#10865)
Troubleshooting
Enable logs
You can set the following environment variable to see debug logs when using this library.
- Getting debug logs from the Azure Anomaly Detector client library
export DEBUG=azure*
Next steps
Please take a look at the samples directory for detailed examples on how to use this library.
Contributing
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
If you'd like to contribute to this library, please read the contributing guide to learn more about how to build and test the code.
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago