Convert Figma logo to code with AI

Azure logoazure-sdk-for-js

This repository is for active development of the Azure SDK for JavaScript (NodeJS & Browser). For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/javascript/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-js.

2,028
1,187
2,028
815

Top Related Projects

This repository is for active development of the Azure SDK for Java. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/java/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-java.

This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.

This repository is for active development of the Azure SDK for Go. For consumers of the SDK we recommend visiting our public developer docs at:

AWS SDK for JavaScript in the browser and Node.js

Google Cloud Client Library for Node.js

Quick Overview

The Azure/azure-sdk-for-js repository contains the Azure SDK for JavaScript, providing a comprehensive set of libraries for interacting with Azure services. It enables developers to easily integrate Azure functionality into their JavaScript and TypeScript applications, supporting both Node.js and browser environments.

Pros

  • Extensive coverage of Azure services with consistent API design
  • Supports both JavaScript and TypeScript with strong typing
  • Regular updates and active maintenance by Microsoft
  • Comprehensive documentation and examples

Cons

  • Large package size due to the extensive service coverage
  • Learning curve for developers new to Azure services
  • Some services may have limited functionality compared to other language SDKs
  • Occasional breaking changes between major versions

Code Examples

  1. Authenticating with Azure Identity:
import { DefaultAzureCredential } from "@azure/identity";

const credential = new DefaultAzureCredential();
  1. Creating a Storage Blob client:
import { BlobServiceClient } from "@azure/storage-blob";

const blobServiceClient = new BlobServiceClient(
  `https://${accountName}.blob.core.windows.net`,
  credential
);
  1. Sending a message to an Azure Service Bus queue:
import { ServiceBusClient } from "@azure/service-bus";

const sbClient = new ServiceBusClient(connectionString);
const sender = sbClient.createSender(queueName);

await sender.sendMessages({ body: "Hello, Azure!" });

Getting Started

  1. Install the desired Azure SDK packages:
npm install @azure/identity @azure/storage-blob @azure/service-bus
  1. Import and use the SDK in your JavaScript/TypeScript code:
import { DefaultAzureCredential } from "@azure/identity";
import { BlobServiceClient } from "@azure/storage-blob";

const credential = new DefaultAzureCredential();
const blobServiceClient = new BlobServiceClient(
  `https://${accountName}.blob.core.windows.net`,
  credential
);

// Use the blobServiceClient to interact with Azure Storage
  1. Refer to the official Azure SDK for JavaScript documentation for detailed usage instructions and examples for specific services.

Competitor Comparisons

This repository is for active development of the Azure SDK for Java. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/java/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-java.

Pros of azure-sdk-for-java

  • More mature and stable ecosystem for enterprise applications
  • Better integration with Java-specific frameworks and tools
  • Stronger type safety and compile-time checks

Cons of azure-sdk-for-java

  • Steeper learning curve for developers new to Java
  • More verbose syntax compared to JavaScript
  • Slower development cycle due to compilation requirements

Code Comparison

azure-sdk-for-java:

BlobServiceClient blobServiceClient = new BlobServiceClientBuilder()
    .connectionString(connectionString)
    .buildClient();
BlobContainerClient containerClient = blobServiceClient.getBlobContainerClient(containerName);
BlobClient blobClient = containerClient.getBlobClient(blobName);
blobClient.upload(InputStream.nullInputStream(), 0);

azure-sdk-for-js:

const blobServiceClient = BlobServiceClient.fromConnectionString(connectionString);
const containerClient = blobServiceClient.getContainerClient(containerName);
const blockBlobClient = containerClient.getBlockBlobClient(blobName);
await blockBlobClient.upload(content, content.length);

The Java SDK offers more explicit type declarations and method chaining, while the JavaScript SDK provides a more concise syntax with async/await support. Both SDKs follow similar patterns for client creation and method calls, but the Java version may be more suitable for large-scale enterprise applications, while the JavaScript version might be preferred for rapid development and serverless scenarios.

This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.

Pros of azure-sdk-for-net

  • More mature and established ecosystem for .NET developers
  • Better integration with Visual Studio and other Microsoft development tools
  • Stronger type safety and compile-time checks

Cons of azure-sdk-for-net

  • Limited cross-platform compatibility compared to JavaScript
  • Steeper learning curve for developers not familiar with C# or .NET
  • Potentially slower development cycles due to compilation requirements

Code Comparison

azure-sdk-for-net:

using Azure.Storage.Blobs;

var blobServiceClient = new BlobServiceClient(connectionString);
var containerClient = blobServiceClient.GetBlobContainerClient(containerName);
await containerClient.CreateIfNotExistsAsync();

azure-sdk-for-js:

const { BlobServiceClient } = require("@azure/storage-blob");

const blobServiceClient = BlobServiceClient.fromConnectionString(connectionString);
const containerClient = blobServiceClient.getContainerClient(containerName);
await containerClient.createIfNotExists();

Both SDKs provide similar functionality, but the syntax and structure differ due to language-specific features and conventions. The .NET SDK uses more explicit typing and async/await patterns, while the JavaScript SDK relies on promises and has a more concise syntax.

This repository is for active development of the Azure SDK for Go. For consumers of the SDK we recommend visiting our public developer docs at:

Pros of azure-sdk-for-go

  • Strong type safety and compile-time checks
  • Better performance due to Go's efficiency
  • Concurrency support with goroutines and channels

Cons of azure-sdk-for-go

  • Less ecosystem support compared to JavaScript
  • Steeper learning curve for developers new to Go
  • Limited browser support (primarily server-side)

Code Comparison

azure-sdk-for-go:

import "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-06-01/storage"

client := storage.NewAccountsClient(subscriptionID)
client.Authorizer = authorizer

result, err := client.ListKeys(ctx, resourceGroupName, accountName)
if err != nil {
    // Handle error
}

azure-sdk-for-js:

import { StorageManagementClient } from "@azure/arm-storage";

const client = new StorageManagementClient(credential, subscriptionId);

const result = await client.storageAccounts.listKeys(resourceGroupName, accountName);

The Go SDK offers stronger typing and explicit error handling, while the JavaScript SDK provides a more concise syntax with Promise-based asynchronous operations. The Go version may be more suitable for large-scale, performance-critical applications, while the JavaScript SDK might be preferred for rapid development and browser-based scenarios.

AWS SDK for JavaScript in the browser and Node.js

Pros of aws-sdk-js

  • More mature and established, with a longer history of development
  • Extensive documentation and community support
  • Comprehensive coverage of AWS services

Cons of aws-sdk-js

  • Larger bundle size, which can impact application performance
  • Less modular structure compared to azure-sdk-for-js
  • Slower adoption of modern JavaScript features

Code Comparison

aws-sdk-js:

const AWS = require('aws-sdk');
const s3 = new AWS.S3();

s3.getObject({ Bucket: 'myBucket', Key: 'myKey' }, (err, data) => {
  if (err) console.log(err, err.stack);
  else console.log(data);
});

azure-sdk-for-js:

const { BlobServiceClient } = require('@azure/storage-blob');
const blobServiceClient = BlobServiceClient.fromConnectionString(connectionString);
const containerClient = blobServiceClient.getContainerClient('myContainer');
const blobClient = containerClient.getBlobClient('myBlob');

const downloadBlockBlobResponse = await blobClient.download();

Key Differences

  • azure-sdk-for-js uses a more modular approach, allowing developers to import only the services they need
  • aws-sdk-js provides a single package for all AWS services, which can be convenient but may lead to larger bundle sizes
  • azure-sdk-for-js tends to use more modern JavaScript features and async/await patterns, while aws-sdk-js often relies on callback-based APIs

Both SDKs are actively maintained and provide robust support for their respective cloud platforms, with the choice often depending on the specific cloud provider being used and project requirements.

Google Cloud Client Library for Node.js

Pros of google-cloud-node

  • More comprehensive documentation and examples
  • Better integration with Google Cloud Platform services
  • Larger community and more frequent updates

Cons of google-cloud-node

  • Steeper learning curve for developers new to Google Cloud
  • Less flexibility in terms of customization options
  • Potentially higher resource usage due to more extensive features

Code Comparison

azure-sdk-for-js:

import { BlobServiceClient } from "@azure/storage-blob";

const blobServiceClient = BlobServiceClient.fromConnectionString(connectionString);
const containerClient = blobServiceClient.getContainerClient(containerName);
await containerClient.uploadBlockBlob(blobName, data, data.length);

google-cloud-node:

const { Storage } = require('@google-cloud/storage');

const storage = new Storage();
const bucket = storage.bucket(bucketName);
await bucket.file(fileName).save(data);

Both SDKs provide similar functionality for cloud storage operations, but google-cloud-node offers a slightly more concise syntax. However, azure-sdk-for-js provides more granular control over the upload process, which can be beneficial in certain scenarios.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Azure SDK for JavaScript

Packages Dependencies DependencyGraph

This repository is for the Azure SDK for JavaScript (Node.js & Browser). It contains libraries for the breadth of Azure services. Management libraries are packages that you would use to provision and manage Azure resources. Client libraries are packages that you would use to consume these resources and interact with them.

Getting started

A few helpful resources to get started are:

  • The readme for each package contains code samples and package information. This readme can be found in the corresponding package folder under the folder of the service of your choice in the /sdk folder of this repository. The same readme file can be found on the landing page for the package in npm.
  • The API reference documentation of the latest versions of these packages, can be found at our public developer docs.
  • The API reference documentation of older versions, can be found in our versioned developer docs.

Each service might have a number of libraries available from each of the following categories:

NOTE: Some of these packages have beta versions. If you need to ensure your code is ready for production, use one of the stable, non-beta packages.

Client

Given an Azure resource already exists, you would use the client libraries to consume it and interact with it. Most of these libraries follow the Azure SDK Design Guidelines for JavaScript & TypeScript and share a number of core functionalities such as retries, logging, transport protocols, authentication protocols, etc. Others will be updated in the near future to follow the guidelines as well.

To get a list of all client libraries that follow the new guidelines, please visit our Azure SDK releases page.

Management

Management libraries enable you to provision and manage Azure resources via the Azure Resource Manager i.e. ARM. You can recognize these libraries by @azure/arm- in their package names. These are purely auto-generated based on the swagger files that represent the APIs for resource management.

Newer versions of these libraries follow the Azure SDK Design Guidelines for TypeScript. These new versions provide a number of core capabilities that are shared amongst all Azure SDKs, including the intuitive Azure Identity library, an HTTP Pipeline with custom policies, error-handling, distributed tracing, and much more. A few helpful resources to get started with these are:

NOTE: If you are experiencing authentication issues with the management libraries after upgrading certain packages, it's possible that you upgraded to the new versions of SDK without changing the authentication code, please refer to the migration guide mentioned above for proper instructions.

Need help?

Community

Try our community resources.

Reporting security issues and security bugs

Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) secure@microsoft.com. You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Further information, including the MSRC PGP key, can be found in the Security TechCenter.

Contributing

For details on contributing to this repository, see the contributing guide.

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 repositories 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.

Impressions

NPM DownloadsLast 30 Days