Overview
Installation
Usage
API Reference
Samples
What is Azure Core?
Azure Core provides shared primitives, helpers, and client‑side utilities used by all Azure SDK packages for JavaScript/TypeScript. It offers consistent authentication, request pipelines, and error handling across services.
Key Features
- Unified
Pipelinefor HTTP request/response handling - Pluggable
Policyarchitecture - Telemetry and tracing support
- Credential abstractions (Azure Identity)
- Retry, logging, and throttling strategies
Installation
Install the core package via npm or yarn.
npm install @azure/core-rest-pipeline
For TypeScript projects, the types are included.
Basic Usage
Create a pipeline and send a request.
import { createPipeline, sendRequest } from "@azure/core-rest-pipeline";
import { bearerTokenAuthenticationPolicy } from "@azure/core-auth";
import { DefaultAzureCredential } from "@azure/identity";
const credential = new DefaultAzureCredential();
const pipeline = createPipeline(
credential,
{
retryOptions: { maxRetries: 3 },
logger: console
}
);
const request = {
url: "https://management.azure.com/subscriptions?api-version=2020-01-01",
method: "GET",
headers: {}
};
await sendRequest(pipeline, request);
API Reference
| Function / Class | Description |
|---|---|
createPipeline(credential, options) | Creates an HTTP pipeline with default policies. |
sendRequest(pipeline, request) | Executes a request through the provided pipeline. |
Pipeline | Interface representing the request/response pipeline. |
HttpHeaders | Utility to manage HTTP header collections. |
RetryPolicyOptions | Configuration for retry behavior. |
LoggingPolicy | Policy that logs request and response details. |
Samples
Explore common scenarios.