diff --git a/sdk/recoveryservicessiterecovery/arm-recoveryservices-siterecovery/README.md b/sdk/recoveryservicessiterecovery/arm-recoveryservices-siterecovery/README.md
index 330bfc2c296c..3e179cc135b9 100644
--- a/sdk/recoveryservicessiterecovery/arm-recoveryservices-siterecovery/README.md
+++ b/sdk/recoveryservicessiterecovery/arm-recoveryservices-siterecovery/README.md
@@ -1,89 +1,100 @@
## Azure SiteRecoveryManagementClient SDK for JavaScript
-This package contains an isomorphic SDK for SiteRecoveryManagementClient.
+This package contains an isomorphic SDK (runs both in Node.js and in browsers) for SiteRecoveryManagementClient.
### Currently supported environments
-- Node.js version 6.x.x or higher
-- Browser JavaScript
+- [LTS versions of Node.js](https://nodejs.org/about/releases/)
+- Latest versions of Safari, Chrome, Edge, and Firefox.
-### How to Install
+### Prerequisites
-```
-npm install @azure/arm-recoveryservices-siterecovery
+You must have an [Azure subscription](https://azure.microsoft.com/free/).
+
+### How to install
+
+To use this SDK in your project, you will need to install two packages.
+- `@azure/arm-recoveryservices-siterecovery` that contains the client.
+- `@azure/identity` that provides different mechanisms for the client to authenticate your requests using Azure Active Directory.
+
+Install both packages using the below command:
+```bash
+npm install --save @azure/arm-recoveryservices-siterecovery @azure/identity
```
+> **Note**: You may have used either `@azure/ms-rest-nodeauth` or `@azure/ms-rest-browserauth` in the past. These packages are in maintenance mode receiving critical bug fixes, but no new features.
+If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/), or are writing a client side browser application, we strongly encourage you to upgrade to `@azure/identity` which uses the latest versions of Azure Active Directory and MSAL APIs and provides more authentication options.
+
### How to use
-#### nodejs - Authentication, client creation and list operations as an example written in TypeScript.
+- If you are writing a client side browser application,
+ - Follow the instructions in the section on Authenticating client side browser applications in [Azure Identity examples](https://aka.ms/azsdk/js/identity/examples) to register your application in the Microsoft identity platform and set the right permissions.
+ - Copy the client ID and tenant ID from the Overview section of your app registration in Azure portal and use it in the browser sample below.
+- If you are writing a server side application,
+ - [Select a credential from `@azure/identity` based on the authentication method of your choice](https://aka.ms/azsdk/js/identity/examples)
+ - Complete the set up steps required by the credential if any.
+ - Use the credential you picked in the place of `DefaultAzureCredential` in the Node.js sample below.
-##### Install @azure/ms-rest-nodeauth
+In the below samples, we pass the credential and the Azure subscription id to instantiate the client.
+Once the client is created, explore the operations on it either in your favorite editor or in our [API reference documentation](https://docs.microsoft.com/javascript/api) to get started.
-```
-npm install @azure/ms-rest-nodeauth
-```
+#### nodejs - Authentication, client creation, and list operations as an example written in JavaScript.
##### Sample code
-```ts
-import * as msRest from "@azure/ms-rest-js";
-import * as msRestAzure from "@azure/ms-rest-azure-js";
-import * as msRestNodeAuth from "@azure/ms-rest-nodeauth";
-import { SiteRecoveryManagementClient, SiteRecoveryManagementModels, SiteRecoveryManagementMappers } from "@azure/arm-recoveryservices-siterecovery";
+```javascript
+const { DefaultAzureCredential } = require("@azure/identity");
+const { SiteRecoveryManagementClient } = require("@azure/arm-recoveryservices-siterecovery");
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
-msRestNodeAuth.interactiveLogin().then((creds) => {
- const client = new SiteRecoveryManagementClient(creds, subscriptionId);
- client.operations.list().then((result) => {
- console.log("The result is:");
- console.log(result);
- });
+// Use `DefaultAzureCredential` or any other credential of your choice based on https://aka.ms/azsdk/js/identity/examples
+// Please note that you can also use credentials from the `@azure/ms-rest-nodeauth` package instead.
+const creds = new DefaultAzureCredential();
+const client = new SiteRecoveryManagementClient(creds, subscriptionId);
+
+client.operations.list().then((result) => {
+ console.log("The result is:");
+ console.log(result);
}).catch((err) => {
+ console.log("An error occurred:");
console.error(err);
});
```
-#### browser - Authentication, client creation and list operations as an example written in JavaScript.
-
-##### Install @azure/ms-rest-browserauth
+#### browser - Authentication, client creation, and list operations as an example written in JavaScript.
-```
-npm install @azure/ms-rest-browserauth
-```
+In browser applications, we recommend using the `InteractiveBrowserCredential` that interactively authenticates using the default system browser.
+ - See [Single-page application: App registration guide](https://docs.microsoft.com/azure/active-directory/develop/scenario-spa-app-registration) to configure your app registration for the browser.
+ - Note down the client Id from the previous step and use it in the browser sample below.
##### Sample code
-See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.
-
- index.html
+
```html
@azure/arm-recoveryservices-siterecovery sample
-
-
+
@@ -95,5 +106,4 @@ See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to
- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js)
-
-
+
diff --git a/sdk/recoveryservicessiterecovery/arm-recoveryservices-siterecovery/package.json b/sdk/recoveryservicessiterecovery/arm-recoveryservices-siterecovery/package.json
index 1376d42c7006..7b0e68bc6d42 100644
--- a/sdk/recoveryservicessiterecovery/arm-recoveryservices-siterecovery/package.json
+++ b/sdk/recoveryservicessiterecovery/arm-recoveryservices-siterecovery/package.json
@@ -2,10 +2,11 @@
"name": "@azure/arm-recoveryservices-siterecovery",
"author": "Microsoft Corporation",
"description": "SiteRecoveryManagementClient Library with typescript type definitions for node.js and browser.",
- "version": "3.2.0",
+ "version": "3.3.0",
"dependencies": {
- "@azure/ms-rest-azure-js": "^1.1.0",
- "@azure/ms-rest-js": "^1.1.0",
+ "@azure/ms-rest-azure-js": "^1.4.0",
+ "@azure/ms-rest-js": "^1.11.0",
+ "@azure/core-auth": "^1.1.4",
"tslib": "^1.9.3"
},
"keywords": [
@@ -20,7 +21,7 @@
"module": "./esm/siteRecoveryManagementClient.js",
"types": "./esm/siteRecoveryManagementClient.d.ts",
"devDependencies": {
- "typescript": "^3.1.1",
+ "typescript": "^3.6.0",
"rollup": "^0.66.2",
"rollup-plugin-node-resolve": "^3.4.0",
"uglify-js": "^3.4.9"
diff --git a/sdk/recoveryservicessiterecovery/arm-recoveryservices-siterecovery/src/siteRecoveryManagementClient.ts b/sdk/recoveryservicessiterecovery/arm-recoveryservices-siterecovery/src/siteRecoveryManagementClient.ts
index 8bfa137ac28f..5050254986bd 100644
--- a/sdk/recoveryservicessiterecovery/arm-recoveryservices-siterecovery/src/siteRecoveryManagementClient.ts
+++ b/sdk/recoveryservicessiterecovery/arm-recoveryservices-siterecovery/src/siteRecoveryManagementClient.ts
@@ -9,6 +9,7 @@
*/
import * as msRest from "@azure/ms-rest-js";
+import { TokenCredential } from "@azure/core-auth";
import * as Models from "./models";
import * as Mappers from "./models/mappers";
import * as operations from "./operations";
@@ -41,14 +42,19 @@ class SiteRecoveryManagementClient extends SiteRecoveryManagementClientContext {
/**
* Initializes a new instance of the SiteRecoveryManagementClient class.
- * @param credentials Credentials needed for the client to connect to Azure.
+ * @param credentials Credentials needed for the client to connect to Azure. Credentials
+ * implementing the TokenCredential interface from the @azure/identity package are recommended. For
+ * more information about these credentials, see
+ * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
+ * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
+ * @azure/ms-rest-browserauth are also supported.
* @param subscriptionId The subscription Id.
* @param resourceGroupName The name of the resource group where the recovery services vault is
* present.
* @param resourceName The name of the recovery services vault.
* @param [options] The parameter options
*/
- constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, resourceGroupName: string, resourceName: string, options?: Models.SiteRecoveryManagementClientOptions) {
+ constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, resourceGroupName: string, resourceName: string, options?: Models.SiteRecoveryManagementClientOptions) {
super(credentials, subscriptionId, resourceGroupName, resourceName, options);
this.operations = new operations.Operations(this);
this.replicationAlertSettings = new operations.ReplicationAlertSettings(this);
diff --git a/sdk/recoveryservicessiterecovery/arm-recoveryservices-siterecovery/src/siteRecoveryManagementClientContext.ts b/sdk/recoveryservicessiterecovery/arm-recoveryservices-siterecovery/src/siteRecoveryManagementClientContext.ts
index 23d375cb660f..7296861ef671 100644
--- a/sdk/recoveryservicessiterecovery/arm-recoveryservices-siterecovery/src/siteRecoveryManagementClientContext.ts
+++ b/sdk/recoveryservicessiterecovery/arm-recoveryservices-siterecovery/src/siteRecoveryManagementClientContext.ts
@@ -10,13 +10,14 @@
import * as Models from "./models";
import * as msRest from "@azure/ms-rest-js";
+import { TokenCredential } from "@azure/core-auth";
import * as msRestAzure from "@azure/ms-rest-azure-js";
const packageName = "@azure/arm-recoveryservices-siterecovery";
-const packageVersion = "0.1.0";
+const packageVersion = "3.3.0";
export class SiteRecoveryManagementClientContext extends msRestAzure.AzureServiceClient {
- credentials: msRest.ServiceClientCredentials;
+ credentials: msRest.ServiceClientCredentials | TokenCredential;
subscriptionId: string;
resourceGroupName: string;
resourceName: string;
@@ -24,14 +25,19 @@ export class SiteRecoveryManagementClientContext extends msRestAzure.AzureServic
/**
* Initializes a new instance of the SiteRecoveryManagementClient class.
- * @param credentials Credentials needed for the client to connect to Azure.
+ * @param credentials Credentials needed for the client to connect to Azure. Credentials
+ * implementing the TokenCredential interface from the @azure/identity package are recommended. For
+ * more information about these credentials, see
+ * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
+ * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
+ * @azure/ms-rest-browserauth are also supported.
* @param subscriptionId The subscription Id.
* @param resourceGroupName The name of the resource group where the recovery services vault is
* present.
* @param resourceName The name of the recovery services vault.
* @param [options] The parameter options
*/
- constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, resourceGroupName: string, resourceName: string, options?: Models.SiteRecoveryManagementClientOptions) {
+ constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, resourceGroupName: string, resourceName: string, options?: Models.SiteRecoveryManagementClientOptions) {
if (credentials == undefined) {
throw new Error('\'credentials\' cannot be null.');
}
diff --git a/sdk/redis/arm-rediscache/README.md b/sdk/redis/arm-rediscache/README.md
index 9fd3b180eb27..fd829f3f5e9c 100644
--- a/sdk/redis/arm-rediscache/README.md
+++ b/sdk/redis/arm-rediscache/README.md
@@ -1,90 +1,100 @@
## Azure RedisManagementClient SDK for JavaScript
-This package contains an isomorphic SDK for RedisManagementClient.
+This package contains an isomorphic SDK (runs both in Node.js and in browsers) for RedisManagementClient.
### Currently supported environments
-- Node.js version 6.x.x or higher
-- Browser JavaScript
+- [LTS versions of Node.js](https://nodejs.org/about/releases/)
+- Latest versions of Safari, Chrome, Edge, and Firefox.
-### How to Install
+### Prerequisites
+You must have an [Azure subscription](https://azure.microsoft.com/free/).
+
+### How to install
+
+To use this SDK in your project, you will need to install two packages.
+- `@azure/arm-rediscache` that contains the client.
+- `@azure/identity` that provides different mechanisms for the client to authenticate your requests using Azure Active Directory.
+
+Install both packages using the below command:
```bash
-npm install @azure/arm-rediscache
+npm install --save @azure/arm-rediscache @azure/identity
```
+> **Note**: You may have used either `@azure/ms-rest-nodeauth` or `@azure/ms-rest-browserauth` in the past. These packages are in maintenance mode receiving critical bug fixes, but no new features.
+If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/), or are writing a client side browser application, we strongly encourage you to upgrade to `@azure/identity` which uses the latest versions of Azure Active Directory and MSAL APIs and provides more authentication options.
+
### How to use
-#### nodejs - Authentication, client creation and list operations as an example written in TypeScript.
+- If you are writing a client side browser application,
+ - Follow the instructions in the section on Authenticating client side browser applications in [Azure Identity examples](https://aka.ms/azsdk/js/identity/examples) to register your application in the Microsoft identity platform and set the right permissions.
+ - Copy the client ID and tenant ID from the Overview section of your app registration in Azure portal and use it in the browser sample below.
+- If you are writing a server side application,
+ - [Select a credential from `@azure/identity` based on the authentication method of your choice](https://aka.ms/azsdk/js/identity/examples)
+ - Complete the set up steps required by the credential if any.
+ - Use the credential you picked in the place of `DefaultAzureCredential` in the Node.js sample below.
-##### Install @azure/ms-rest-nodeauth
+In the below samples, we pass the credential and the Azure subscription id to instantiate the client.
+Once the client is created, explore the operations on it either in your favorite editor or in our [API reference documentation](https://docs.microsoft.com/javascript/api) to get started.
-- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`.
-```bash
-npm install @azure/ms-rest-nodeauth@"^3.0.0"
-```
+#### nodejs - Authentication, client creation, and list operations as an example written in JavaScript.
##### Sample code
-```typescript
-import * as msRest from "@azure/ms-rest-js";
-import * as msRestAzure from "@azure/ms-rest-azure-js";
-import * as msRestNodeAuth from "@azure/ms-rest-nodeauth";
-import { RedisManagementClient, RedisManagementModels, RedisManagementMappers } from "@azure/arm-rediscache";
+```javascript
+const { DefaultAzureCredential } = require("@azure/identity");
+const { RedisManagementClient } = require("@azure/arm-rediscache");
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
-msRestNodeAuth.interactiveLogin().then((creds) => {
- const client = new RedisManagementClient(creds, subscriptionId);
- client.operations.list().then((result) => {
- console.log("The result is:");
- console.log(result);
- });
+// Use `DefaultAzureCredential` or any other credential of your choice based on https://aka.ms/azsdk/js/identity/examples
+// Please note that you can also use credentials from the `@azure/ms-rest-nodeauth` package instead.
+const creds = new DefaultAzureCredential();
+const client = new RedisManagementClient(creds, subscriptionId);
+
+client.operations.list().then((result) => {
+ console.log("The result is:");
+ console.log(result);
}).catch((err) => {
+ console.log("An error occurred:");
console.error(err);
});
```
-#### browser - Authentication, client creation and list operations as an example written in JavaScript.
-
-##### Install @azure/ms-rest-browserauth
+#### browser - Authentication, client creation, and list operations as an example written in JavaScript.
-```bash
-npm install @azure/ms-rest-browserauth
-```
+In browser applications, we recommend using the `InteractiveBrowserCredential` that interactively authenticates using the default system browser.
+ - See [Single-page application: App registration guide](https://docs.microsoft.com/azure/active-directory/develop/scenario-spa-app-registration) to configure your app registration for the browser.
+ - Note down the client Id from the previous step and use it in the browser sample below.
##### Sample code
-See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.
-
- index.html
+
```html
@azure/arm-rediscache sample
-
-
+
diff --git a/sdk/redis/arm-rediscache/package.json b/sdk/redis/arm-rediscache/package.json
index 1938144a46ee..8aea4be4babb 100644
--- a/sdk/redis/arm-rediscache/package.json
+++ b/sdk/redis/arm-rediscache/package.json
@@ -2,10 +2,11 @@
"name": "@azure/arm-rediscache",
"author": "Microsoft Corporation",
"description": "RedisManagementClient Library with typescript type definitions for node.js and browser.",
- "version": "4.0.0",
+ "version": "4.1.0",
"dependencies": {
- "@azure/ms-rest-azure-js": "^2.0.1",
- "@azure/ms-rest-js": "^2.0.4",
+ "@azure/ms-rest-azure-js": "^2.1.0",
+ "@azure/ms-rest-js": "^2.2.0",
+ "@azure/core-auth": "^1.1.4",
"tslib": "^1.10.0"
},
"keywords": [
@@ -20,7 +21,7 @@
"module": "./esm/redisManagementClient.js",
"types": "./esm/redisManagementClient.d.ts",
"devDependencies": {
- "typescript": "^3.5.3",
+ "typescript": "^3.6.0",
"rollup": "^1.18.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-sourcemaps": "^0.4.2",
diff --git a/sdk/redis/arm-rediscache/src/redisManagementClient.ts b/sdk/redis/arm-rediscache/src/redisManagementClient.ts
index cd3b8b9dfe2e..c5f44bc0b291 100644
--- a/sdk/redis/arm-rediscache/src/redisManagementClient.ts
+++ b/sdk/redis/arm-rediscache/src/redisManagementClient.ts
@@ -9,6 +9,7 @@
*/
import * as msRest from "@azure/ms-rest-js";
+import { TokenCredential } from "@azure/core-auth";
import * as Models from "./models";
import * as Mappers from "./models/mappers";
import * as operations from "./operations";
@@ -25,12 +26,17 @@ class RedisManagementClient extends RedisManagementClientContext {
/**
* Initializes a new instance of the RedisManagementClient class.
- * @param credentials Credentials needed for the client to connect to Azure.
+ * @param credentials Credentials needed for the client to connect to Azure. Credentials
+ * implementing the TokenCredential interface from the @azure/identity package are recommended. For
+ * more information about these credentials, see
+ * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
+ * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
+ * @azure/ms-rest-browserauth are also supported.
* @param subscriptionId Gets subscription credentials which uniquely identify the Microsoft Azure
* subscription. The subscription ID forms part of the URI for every service call.
* @param [options] The parameter options
*/
- constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.RedisManagementClientOptions) {
+ constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.RedisManagementClientOptions) {
super(credentials, subscriptionId, options);
this.operations = new operations.Operations(this);
this.redis = new operations.Redis(this);
diff --git a/sdk/redis/arm-rediscache/src/redisManagementClientContext.ts b/sdk/redis/arm-rediscache/src/redisManagementClientContext.ts
index 286d06abeb1f..873bdcf1b787 100644
--- a/sdk/redis/arm-rediscache/src/redisManagementClientContext.ts
+++ b/sdk/redis/arm-rediscache/src/redisManagementClientContext.ts
@@ -10,24 +10,30 @@
import * as Models from "./models";
import * as msRest from "@azure/ms-rest-js";
+import { TokenCredential } from "@azure/core-auth";
import * as msRestAzure from "@azure/ms-rest-azure-js";
const packageName = "@azure/arm-rediscache";
-const packageVersion = "4.0.0";
+const packageVersion = "4.1.0";
export class RedisManagementClientContext extends msRestAzure.AzureServiceClient {
- credentials: msRest.ServiceClientCredentials;
+ credentials: msRest.ServiceClientCredentials | TokenCredential;
subscriptionId: string;
apiVersion?: string;
/**
* Initializes a new instance of the RedisManagementClient class.
- * @param credentials Credentials needed for the client to connect to Azure.
+ * @param credentials Credentials needed for the client to connect to Azure. Credentials
+ * implementing the TokenCredential interface from the @azure/identity package are recommended. For
+ * more information about these credentials, see
+ * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
+ * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
+ * @azure/ms-rest-browserauth are also supported.
* @param subscriptionId Gets subscription credentials which uniquely identify the Microsoft Azure
* subscription. The subscription ID forms part of the URI for every service call.
* @param [options] The parameter options
*/
- constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.RedisManagementClientOptions) {
+ constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.RedisManagementClientOptions) {
if (credentials == undefined) {
throw new Error('\'credentials\' cannot be null.');
}
diff --git a/sdk/redisenterprise/arm-redisenterprisecache/README.md b/sdk/redisenterprise/arm-redisenterprisecache/README.md
index 5281f220eba8..f29210e8558f 100644
--- a/sdk/redisenterprise/arm-redisenterprisecache/README.md
+++ b/sdk/redisenterprise/arm-redisenterprisecache/README.md
@@ -1,89 +1,100 @@
## Azure RedisEnterpriseManagementClient SDK for JavaScript
-This package contains an isomorphic SDK for RedisEnterpriseManagementClient.
+This package contains an isomorphic SDK (runs both in Node.js and in browsers) for RedisEnterpriseManagementClient.
### Currently supported environments
-- Node.js version 6.x.x or higher
-- Browser JavaScript
+- [LTS versions of Node.js](https://nodejs.org/about/releases/)
+- Latest versions of Safari, Chrome, Edge, and Firefox.
-### How to Install
+### Prerequisites
+You must have an [Azure subscription](https://azure.microsoft.com/free/).
+
+### How to install
+
+To use this SDK in your project, you will need to install two packages.
+- `@azure/arm-redisenterprisecache` that contains the client.
+- `@azure/identity` that provides different mechanisms for the client to authenticate your requests using Azure Active Directory.
+
+Install both packages using the below command:
```bash
-npm install @azure/arm-redisenterprisecache
+npm install --save @azure/arm-redisenterprisecache @azure/identity
```
+> **Note**: You may have used either `@azure/ms-rest-nodeauth` or `@azure/ms-rest-browserauth` in the past. These packages are in maintenance mode receiving critical bug fixes, but no new features.
+If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/), or are writing a client side browser application, we strongly encourage you to upgrade to `@azure/identity` which uses the latest versions of Azure Active Directory and MSAL APIs and provides more authentication options.
+
### How to use
-#### nodejs - client creation and list operations as an example written in TypeScript.
+- If you are writing a client side browser application,
+ - Follow the instructions in the section on Authenticating client side browser applications in [Azure Identity examples](https://aka.ms/azsdk/js/identity/examples) to register your application in the Microsoft identity platform and set the right permissions.
+ - Copy the client ID and tenant ID from the Overview section of your app registration in Azure portal and use it in the browser sample below.
+- If you are writing a server side application,
+ - [Select a credential from `@azure/identity` based on the authentication method of your choice](https://aka.ms/azsdk/js/identity/examples)
+ - Complete the set up steps required by the credential if any.
+ - Use the credential you picked in the place of `DefaultAzureCredential` in the Node.js sample below.
-##### Install @azure/ms-rest-nodeauth
+In the below samples, we pass the credential and the Azure subscription id to instantiate the client.
+Once the client is created, explore the operations on it either in your favorite editor or in our [API reference documentation](https://docs.microsoft.com/javascript/api) to get started.
-- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`.
-```bash
-npm install @azure/ms-rest-nodeauth@"^3.0.0"
-```
+#### nodejs - Authentication, client creation, and list operations as an example written in JavaScript.
##### Sample code
-While the below sample uses the interactive login, other authentication options can be found in the [README.md file of @azure/ms-rest-nodeauth](https://www.npmjs.com/package/@azure/ms-rest-nodeauth) package
-```typescript
-const msRestNodeAuth = require("@azure/ms-rest-nodeauth");
+```javascript
+const { DefaultAzureCredential } = require("@azure/identity");
const { RedisEnterpriseManagementClient } = require("@azure/arm-redisenterprisecache");
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
-msRestNodeAuth.interactiveLogin().then((creds) => {
- const client = new RedisEnterpriseManagementClient(creds, subscriptionId);
- client.operations.list().then((result) => {
- console.log("The result is:");
- console.log(result);
- });
+// Use `DefaultAzureCredential` or any other credential of your choice based on https://aka.ms/azsdk/js/identity/examples
+// Please note that you can also use credentials from the `@azure/ms-rest-nodeauth` package instead.
+const creds = new DefaultAzureCredential();
+const client = new RedisEnterpriseManagementClient(creds, subscriptionId);
+
+client.operations.list().then((result) => {
+ console.log("The result is:");
+ console.log(result);
}).catch((err) => {
+ console.log("An error occurred:");
console.error(err);
});
```
-#### browser - Authentication, client creation and list operations as an example written in JavaScript.
-
-##### Install @azure/ms-rest-browserauth
+#### browser - Authentication, client creation, and list operations as an example written in JavaScript.
-```bash
-npm install @azure/ms-rest-browserauth
-```
+In browser applications, we recommend using the `InteractiveBrowserCredential` that interactively authenticates using the default system browser.
+ - See [Single-page application: App registration guide](https://docs.microsoft.com/azure/active-directory/develop/scenario-spa-app-registration) to configure your app registration for the browser.
+ - Note down the client Id from the previous step and use it in the browser sample below.
##### Sample code
-See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.
-
- index.html
+
```html
@azure/arm-redisenterprisecache sample
-
-
+
diff --git a/sdk/redisenterprise/arm-redisenterprisecache/package.json b/sdk/redisenterprise/arm-redisenterprisecache/package.json
index 016c6da09bcf..1c0617fecd66 100644
--- a/sdk/redisenterprise/arm-redisenterprisecache/package.json
+++ b/sdk/redisenterprise/arm-redisenterprisecache/package.json
@@ -2,10 +2,11 @@
"name": "@azure/arm-redisenterprisecache",
"author": "Microsoft Corporation",
"description": "RedisEnterpriseManagementClient Library with typescript type definitions for node.js and browser.",
- "version": "1.0.0",
+ "version": "1.1.0",
"dependencies": {
- "@azure/ms-rest-azure-js": "^2.0.1",
- "@azure/ms-rest-js": "^2.0.4",
+ "@azure/ms-rest-azure-js": "^2.1.0",
+ "@azure/ms-rest-js": "^2.2.0",
+ "@azure/core-auth": "^1.1.4",
"tslib": "^1.10.0"
},
"keywords": [
@@ -20,7 +21,7 @@
"module": "./esm/redisEnterpriseManagementClient.js",
"types": "./esm/redisEnterpriseManagementClient.d.ts",
"devDependencies": {
- "typescript": "^3.5.3",
+ "typescript": "^3.6.0",
"rollup": "^1.18.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-sourcemaps": "^0.4.2",
diff --git a/sdk/redisenterprise/arm-redisenterprisecache/src/redisEnterpriseManagementClient.ts b/sdk/redisenterprise/arm-redisenterprisecache/src/redisEnterpriseManagementClient.ts
index 39c21aeb4b84..2200130dcf27 100644
--- a/sdk/redisenterprise/arm-redisenterprisecache/src/redisEnterpriseManagementClient.ts
+++ b/sdk/redisenterprise/arm-redisenterprisecache/src/redisEnterpriseManagementClient.ts
@@ -8,6 +8,7 @@
*/
import * as msRest from "@azure/ms-rest-js";
+import { TokenCredential } from "@azure/core-auth";
import * as Models from "./models";
import * as Mappers from "./models/mappers";
import * as operations from "./operations";
@@ -25,11 +26,16 @@ class RedisEnterpriseManagementClient extends RedisEnterpriseManagementClientCon
/**
* Initializes a new instance of the RedisEnterpriseManagementClient class.
- * @param credentials Credentials needed for the client to connect to Azure.
+ * @param credentials Credentials needed for the client to connect to Azure. Credentials
+ * implementing the TokenCredential interface from the @azure/identity package are recommended. For
+ * more information about these credentials, see
+ * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
+ * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
+ * @azure/ms-rest-browserauth are also supported.
* @param subscriptionId The ID of the target subscription.
* @param [options] The parameter options
*/
- constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.RedisEnterpriseManagementClientOptions) {
+ constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.RedisEnterpriseManagementClientOptions) {
super(credentials, subscriptionId, options);
this.operations = new operations.Operations(this);
this.operationsStatus = new operations.OperationsStatus(this);
diff --git a/sdk/redisenterprise/arm-redisenterprisecache/src/redisEnterpriseManagementClientContext.ts b/sdk/redisenterprise/arm-redisenterprisecache/src/redisEnterpriseManagementClientContext.ts
index 3682ef12303b..cbf5215c0cb7 100644
--- a/sdk/redisenterprise/arm-redisenterprisecache/src/redisEnterpriseManagementClientContext.ts
+++ b/sdk/redisenterprise/arm-redisenterprisecache/src/redisEnterpriseManagementClientContext.ts
@@ -9,23 +9,29 @@
import * as Models from "./models";
import * as msRest from "@azure/ms-rest-js";
+import { TokenCredential } from "@azure/core-auth";
import * as msRestAzure from "@azure/ms-rest-azure-js";
const packageName = "@azure/arm-redisenterprisecache";
-const packageVersion = "1.0.0";
+const packageVersion = "1.1.0";
export class RedisEnterpriseManagementClientContext extends msRestAzure.AzureServiceClient {
- credentials: msRest.ServiceClientCredentials;
+ credentials: msRest.ServiceClientCredentials | TokenCredential;
subscriptionId: string;
apiVersion?: string;
/**
* Initializes a new instance of the RedisEnterpriseManagementClient class.
- * @param credentials Credentials needed for the client to connect to Azure.
+ * @param credentials Credentials needed for the client to connect to Azure. Credentials
+ * implementing the TokenCredential interface from the @azure/identity package are recommended. For
+ * more information about these credentials, see
+ * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
+ * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
+ * @azure/ms-rest-browserauth are also supported.
* @param subscriptionId The ID of the target subscription.
* @param [options] The parameter options
*/
- constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.RedisEnterpriseManagementClientOptions) {
+ constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.RedisEnterpriseManagementClientOptions) {
if (credentials == undefined) {
throw new Error('\'credentials\' cannot be null.');
}
diff --git a/sdk/relay/arm-relay/README.md b/sdk/relay/arm-relay/README.md
index 3a7fb18fcc3d..b7ba05513e99 100644
--- a/sdk/relay/arm-relay/README.md
+++ b/sdk/relay/arm-relay/README.md
@@ -1,89 +1,100 @@
## Azure RelayManagementClient SDK for JavaScript
-This package contains an isomorphic SDK for RelayManagementClient.
+This package contains an isomorphic SDK (runs both in Node.js and in browsers) for RelayManagementClient.
### Currently supported environments
-- Node.js version 6.x.x or higher
-- Browser JavaScript
+- [LTS versions of Node.js](https://nodejs.org/about/releases/)
+- Latest versions of Safari, Chrome, Edge, and Firefox.
-### How to Install
+### Prerequisites
-```
-npm install @azure/arm-relay
+You must have an [Azure subscription](https://azure.microsoft.com/free/).
+
+### How to install
+
+To use this SDK in your project, you will need to install two packages.
+- `@azure/arm-relay` that contains the client.
+- `@azure/identity` that provides different mechanisms for the client to authenticate your requests using Azure Active Directory.
+
+Install both packages using the below command:
+```bash
+npm install --save @azure/arm-relay @azure/identity
```
+> **Note**: You may have used either `@azure/ms-rest-nodeauth` or `@azure/ms-rest-browserauth` in the past. These packages are in maintenance mode receiving critical bug fixes, but no new features.
+If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/), or are writing a client side browser application, we strongly encourage you to upgrade to `@azure/identity` which uses the latest versions of Azure Active Directory and MSAL APIs and provides more authentication options.
+
### How to use
-#### nodejs - Authentication, client creation and list operations as an example written in TypeScript.
+- If you are writing a client side browser application,
+ - Follow the instructions in the section on Authenticating client side browser applications in [Azure Identity examples](https://aka.ms/azsdk/js/identity/examples) to register your application in the Microsoft identity platform and set the right permissions.
+ - Copy the client ID and tenant ID from the Overview section of your app registration in Azure portal and use it in the browser sample below.
+- If you are writing a server side application,
+ - [Select a credential from `@azure/identity` based on the authentication method of your choice](https://aka.ms/azsdk/js/identity/examples)
+ - Complete the set up steps required by the credential if any.
+ - Use the credential you picked in the place of `DefaultAzureCredential` in the Node.js sample below.
-##### Install @azure/ms-rest-nodeauth
+In the below samples, we pass the credential and the Azure subscription id to instantiate the client.
+Once the client is created, explore the operations on it either in your favorite editor or in our [API reference documentation](https://docs.microsoft.com/javascript/api) to get started.
-```
-npm install @azure/ms-rest-nodeauth
-```
+#### nodejs - Authentication, client creation, and list operations as an example written in JavaScript.
##### Sample code
-```ts
-import * as msRest from "@azure/ms-rest-js";
-import * as msRestAzure from "@azure/ms-rest-azure-js";
-import * as msRestNodeAuth from "@azure/ms-rest-nodeauth";
-import { RelayManagementClient, RelayManagementModels, RelayManagementMappers } from "@azure/arm-relay";
+```javascript
+const { DefaultAzureCredential } = require("@azure/identity");
+const { RelayManagementClient } = require("@azure/arm-relay");
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
-msRestNodeAuth.interactiveLogin().then((creds) => {
- const client = new RelayManagementClient(creds, subscriptionId);
- client.operations.list().then((result) => {
- console.log("The result is:");
- console.log(result);
- });
+// Use `DefaultAzureCredential` or any other credential of your choice based on https://aka.ms/azsdk/js/identity/examples
+// Please note that you can also use credentials from the `@azure/ms-rest-nodeauth` package instead.
+const creds = new DefaultAzureCredential();
+const client = new RelayManagementClient(creds, subscriptionId);
+
+client.operations.list().then((result) => {
+ console.log("The result is:");
+ console.log(result);
}).catch((err) => {
+ console.log("An error occurred:");
console.error(err);
});
```
-#### browser - Authentication, client creation and list operations as an example written in JavaScript.
-
-##### Install @azure/ms-rest-browserauth
+#### browser - Authentication, client creation, and list operations as an example written in JavaScript.
-```
-npm install @azure/ms-rest-browserauth
-```
+In browser applications, we recommend using the `InteractiveBrowserCredential` that interactively authenticates using the default system browser.
+ - See [Single-page application: App registration guide](https://docs.microsoft.com/azure/active-directory/develop/scenario-spa-app-registration) to configure your app registration for the browser.
+ - Note down the client Id from the previous step and use it in the browser sample below.
##### Sample code
-See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.
-
- index.html
+
```html
@azure/arm-relay sample
-
-
+
@@ -95,5 +106,4 @@ See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to
- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js)
-
-
+
diff --git a/sdk/relay/arm-relay/package.json b/sdk/relay/arm-relay/package.json
index 22d8588356f6..9c424a274b3e 100644
--- a/sdk/relay/arm-relay/package.json
+++ b/sdk/relay/arm-relay/package.json
@@ -2,10 +2,11 @@
"name": "@azure/arm-relay",
"author": "Microsoft Corporation",
"description": "RelayManagementClient Library with typescript type definitions for node.js and browser.",
- "version": "2.1.0",
+ "version": "2.2.0",
"dependencies": {
- "@azure/ms-rest-azure-js": "^1.1.0",
- "@azure/ms-rest-js": "^1.1.0",
+ "@azure/ms-rest-azure-js": "^1.4.0",
+ "@azure/ms-rest-js": "^1.11.0",
+ "@azure/core-auth": "^1.1.4",
"tslib": "^1.9.3"
},
"keywords": [
@@ -20,7 +21,7 @@
"module": "./esm/relayManagementClient.js",
"types": "./esm/relayManagementClient.d.ts",
"devDependencies": {
- "typescript": "^3.1.1",
+ "typescript": "^3.6.0",
"rollup": "^0.66.2",
"rollup-plugin-node-resolve": "^3.4.0",
"uglify-js": "^3.4.9"
diff --git a/sdk/relay/arm-relay/src/relayManagementClient.ts b/sdk/relay/arm-relay/src/relayManagementClient.ts
index 41bfce598bec..d147eb79ed38 100644
--- a/sdk/relay/arm-relay/src/relayManagementClient.ts
+++ b/sdk/relay/arm-relay/src/relayManagementClient.ts
@@ -9,6 +9,7 @@
*/
import * as msRest from "@azure/ms-rest-js";
+import { TokenCredential } from "@azure/core-auth";
import * as Models from "./models";
import * as Mappers from "./models/mappers";
import * as operations from "./operations";
@@ -24,12 +25,17 @@ class RelayManagementClient extends RelayManagementClientContext {
/**
* Initializes a new instance of the RelayManagementClient class.
- * @param credentials Credentials needed for the client to connect to Azure.
+ * @param credentials Credentials needed for the client to connect to Azure. Credentials
+ * implementing the TokenCredential interface from the @azure/identity package are recommended. For
+ * more information about these credentials, see
+ * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
+ * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
+ * @azure/ms-rest-browserauth are also supported.
* @param subscriptionId Subscription credentials which uniquely identify the Microsoft Azure
* subscription. The subscription ID forms part of the URI for every service call.
* @param [options] The parameter options
*/
- constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.RelayManagementClientOptions) {
+ constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.RelayManagementClientOptions) {
super(credentials, subscriptionId, options);
this.operations = new operations.Operations(this);
this.namespaces = new operations.Namespaces(this);
diff --git a/sdk/relay/arm-relay/src/relayManagementClientContext.ts b/sdk/relay/arm-relay/src/relayManagementClientContext.ts
index a00071e51c98..c5b8969552e1 100644
--- a/sdk/relay/arm-relay/src/relayManagementClientContext.ts
+++ b/sdk/relay/arm-relay/src/relayManagementClientContext.ts
@@ -10,24 +10,30 @@
import * as Models from "./models";
import * as msRest from "@azure/ms-rest-js";
+import { TokenCredential } from "@azure/core-auth";
import * as msRestAzure from "@azure/ms-rest-azure-js";
const packageName = "@azure/arm-relay";
-const packageVersion = "0.1.0";
+const packageVersion = "2.2.0";
export class RelayManagementClientContext extends msRestAzure.AzureServiceClient {
- credentials: msRest.ServiceClientCredentials;
+ credentials: msRest.ServiceClientCredentials | TokenCredential;
subscriptionId: string;
apiVersion?: string;
/**
* Initializes a new instance of the RelayManagementClient class.
- * @param credentials Credentials needed for the client to connect to Azure.
+ * @param credentials Credentials needed for the client to connect to Azure. Credentials
+ * implementing the TokenCredential interface from the @azure/identity package are recommended. For
+ * more information about these credentials, see
+ * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
+ * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
+ * @azure/ms-rest-browserauth are also supported.
* @param subscriptionId Subscription credentials which uniquely identify the Microsoft Azure
* subscription. The subscription ID forms part of the URI for every service call.
* @param [options] The parameter options
*/
- constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.RelayManagementClientOptions) {
+ constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.RelayManagementClientOptions) {
if (credentials == undefined) {
throw new Error('\'credentials\' cannot be null.');
}
diff --git a/sdk/resourcegraph/arm-resourcegraph/README.md b/sdk/resourcegraph/arm-resourcegraph/README.md
index b12be35165b5..8bb4101de629 100644
--- a/sdk/resourcegraph/arm-resourcegraph/README.md
+++ b/sdk/resourcegraph/arm-resourcegraph/README.md
@@ -1,89 +1,100 @@
## Azure ResourceGraphClient SDK for JavaScript
-This package contains an isomorphic SDK for ResourceGraphClient.
+This package contains an isomorphic SDK (runs both in Node.js and in browsers) for ResourceGraphClient.
### Currently supported environments
-- Node.js version 6.x.x or higher
-- Browser JavaScript
+- [LTS versions of Node.js](https://nodejs.org/about/releases/)
+- Latest versions of Safari, Chrome, Edge, and Firefox.
-### How to Install
+### Prerequisites
+You must have an [Azure subscription](https://azure.microsoft.com/free/).
+
+### How to install
+
+To use this SDK in your project, you will need to install two packages.
+- `@azure/arm-resourcegraph` that contains the client.
+- `@azure/identity` that provides different mechanisms for the client to authenticate your requests using Azure Active Directory.
+
+Install both packages using the below command:
```bash
-npm install @azure/arm-resourcegraph
+npm install --save @azure/arm-resourcegraph @azure/identity
```
+> **Note**: You may have used either `@azure/ms-rest-nodeauth` or `@azure/ms-rest-browserauth` in the past. These packages are in maintenance mode receiving critical bug fixes, but no new features.
+If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/), or are writing a client side browser application, we strongly encourage you to upgrade to `@azure/identity` which uses the latest versions of Azure Active Directory and MSAL APIs and provides more authentication options.
+
### How to use
-#### nodejs - client creation and list operations as an example written in TypeScript.
+- If you are writing a client side browser application,
+ - Follow the instructions in the section on Authenticating client side browser applications in [Azure Identity examples](https://aka.ms/azsdk/js/identity/examples) to register your application in the Microsoft identity platform and set the right permissions.
+ - Copy the client ID and tenant ID from the Overview section of your app registration in Azure portal and use it in the browser sample below.
+- If you are writing a server side application,
+ - [Select a credential from `@azure/identity` based on the authentication method of your choice](https://aka.ms/azsdk/js/identity/examples)
+ - Complete the set up steps required by the credential if any.
+ - Use the credential you picked in the place of `DefaultAzureCredential` in the Node.js sample below.
-##### Install @azure/ms-rest-nodeauth
+In the below samples, we pass the credential and the Azure subscription id to instantiate the client.
+Once the client is created, explore the operations on it either in your favorite editor or in our [API reference documentation](https://docs.microsoft.com/javascript/api) to get started.
-- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`.
-```bash
-npm install @azure/ms-rest-nodeauth@"^3.0.0"
-```
+#### nodejs - Authentication, client creation, and list operations as an example written in JavaScript.
##### Sample code
-While the below sample uses the interactive login, other authentication options can be found in the [README.md file of @azure/ms-rest-nodeauth](https://www.npmjs.com/package/@azure/ms-rest-nodeauth) package
-```typescript
-const msRestNodeAuth = require("@azure/ms-rest-nodeauth");
+```javascript
+const { DefaultAzureCredential } = require("@azure/identity");
const { ResourceGraphClient } = require("@azure/arm-resourcegraph");
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
-msRestNodeAuth.interactiveLogin().then((creds) => {
- const client = new ResourceGraphClient(creds, subscriptionId);
- client.operations.list().then((result) => {
- console.log("The result is:");
- console.log(result);
- });
+// Use `DefaultAzureCredential` or any other credential of your choice based on https://aka.ms/azsdk/js/identity/examples
+// Please note that you can also use credentials from the `@azure/ms-rest-nodeauth` package instead.
+const creds = new DefaultAzureCredential();
+const client = new ResourceGraphClient(creds, subscriptionId);
+
+client.operations.list().then((result) => {
+ console.log("The result is:");
+ console.log(result);
}).catch((err) => {
+ console.log("An error occurred:");
console.error(err);
});
```
-#### browser - Authentication, client creation and list operations as an example written in JavaScript.
-
-##### Install @azure/ms-rest-browserauth
+#### browser - Authentication, client creation, and list operations as an example written in JavaScript.
-```bash
-npm install @azure/ms-rest-browserauth
-```
+In browser applications, we recommend using the `InteractiveBrowserCredential` that interactively authenticates using the default system browser.
+ - See [Single-page application: App registration guide](https://docs.microsoft.com/azure/active-directory/develop/scenario-spa-app-registration) to configure your app registration for the browser.
+ - Note down the client Id from the previous step and use it in the browser sample below.
##### Sample code
-See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.
-
- index.html
+
```html
@azure/arm-resourcegraph sample
-
-
+
diff --git a/sdk/resourcegraph/arm-resourcegraph/package.json b/sdk/resourcegraph/arm-resourcegraph/package.json
index df62daefb40e..22a8f2d81d68 100644
--- a/sdk/resourcegraph/arm-resourcegraph/package.json
+++ b/sdk/resourcegraph/arm-resourcegraph/package.json
@@ -2,10 +2,11 @@
"name": "@azure/arm-resourcegraph",
"author": "Microsoft Corporation",
"description": "ResourceGraphClient Library with typescript type definitions for node.js and browser.",
- "version": "4.1.0",
+ "version": "4.2.0",
"dependencies": {
- "@azure/ms-rest-azure-js": "^2.0.1",
- "@azure/ms-rest-js": "^2.0.4",
+ "@azure/ms-rest-azure-js": "^2.1.0",
+ "@azure/ms-rest-js": "^2.2.0",
+ "@azure/core-auth": "^1.1.4",
"tslib": "^1.10.0"
},
"keywords": [
@@ -20,7 +21,7 @@
"module": "./esm/resourceGraphClient.js",
"types": "./esm/resourceGraphClient.d.ts",
"devDependencies": {
- "typescript": "^3.5.3",
+ "typescript": "^3.6.0",
"rollup": "^1.18.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-sourcemaps": "^0.4.2",
diff --git a/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClient.ts b/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClient.ts
index c10ca6faa968..ada6b1d910d3 100644
--- a/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClient.ts
+++ b/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClient.ts
@@ -8,6 +8,7 @@
*/
import * as msRest from "@azure/ms-rest-js";
+import { TokenCredential } from "@azure/core-auth";
import * as Models from "./models";
import * as Mappers from "./models/mappers";
import * as Parameters from "./models/parameters";
@@ -20,11 +21,16 @@ class ResourceGraphClient extends ResourceGraphClientContext {
/**
* Initializes a new instance of the ResourceGraphClient class.
- * @param credentials Credentials needed for the client to connect to Azure.
+ * @param credentials Credentials needed for the client to connect to Azure. Credentials
+ * implementing the TokenCredential interface from the @azure/identity package are recommended. For
+ * more information about these credentials, see
+ * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
+ * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
+ * @azure/ms-rest-browserauth are also supported.
* @param [options] The parameter options
*/
constructor(
- credentials: msRest.ServiceClientCredentials,
+ credentials: msRest.ServiceClientCredentials | TokenCredential,
options?: Models.ResourceGraphClientOptions
) {
super(credentials, options);
diff --git a/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClientContext.ts b/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClientContext.ts
index 16131061fc42..b27af6121d9d 100644
--- a/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClientContext.ts
+++ b/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClientContext.ts
@@ -9,21 +9,27 @@
import * as Models from "./models";
import * as msRest from "@azure/ms-rest-js";
+import { TokenCredential } from "@azure/core-auth";
import * as msRestAzure from "@azure/ms-rest-azure-js";
const packageName = "@azure/arm-resourcegraph";
-const packageVersion = "4.1.0";
+const packageVersion = "4.2.0";
export class ResourceGraphClientContext extends msRestAzure.AzureServiceClient {
- credentials: msRest.ServiceClientCredentials;
+ credentials: msRest.ServiceClientCredentials | TokenCredential;
/**
* Initializes a new instance of the ResourceGraphClient class.
- * @param credentials Credentials needed for the client to connect to Azure.
+ * @param credentials Credentials needed for the client to connect to Azure. Credentials
+ * implementing the TokenCredential interface from the @azure/identity package are recommended. For
+ * more information about these credentials, see
+ * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
+ * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
+ * @azure/ms-rest-browserauth are also supported.
* @param [options] The parameter options
*/
constructor(
- credentials: msRest.ServiceClientCredentials,
+ credentials: msRest.ServiceClientCredentials | TokenCredential,
options?: Models.ResourceGraphClientOptions
) {
if (credentials == undefined) {
diff --git a/sdk/resourcehealth/arm-resourcehealth/README.md b/sdk/resourcehealth/arm-resourcehealth/README.md
index daefef06fe23..3ca1433748b3 100644
--- a/sdk/resourcehealth/arm-resourcehealth/README.md
+++ b/sdk/resourcehealth/arm-resourcehealth/README.md
@@ -1,93 +1,103 @@
## Azure MicrosoftResourceHealth SDK for JavaScript
-This package contains an isomorphic SDK for MicrosoftResourceHealth.
+This package contains an isomorphic SDK (runs both in Node.js and in browsers) for MicrosoftResourceHealth.
### Currently supported environments
-- Node.js version 6.x.x or higher
-- Browser JavaScript
+- [LTS versions of Node.js](https://nodejs.org/about/releases/)
+- Latest versions of Safari, Chrome, Edge, and Firefox.
-### How to Install
+### Prerequisites
-```
-npm install @azure/arm-resourcehealth
+You must have an [Azure subscription](https://azure.microsoft.com/free/).
+
+### How to install
+
+To use this SDK in your project, you will need to install two packages.
+- `@azure/arm-resourcehealth` that contains the client.
+- `@azure/identity` that provides different mechanisms for the client to authenticate your requests using Azure Active Directory.
+
+Install both packages using the below command:
+```bash
+npm install --save @azure/arm-resourcehealth @azure/identity
```
+> **Note**: You may have used either `@azure/ms-rest-nodeauth` or `@azure/ms-rest-browserauth` in the past. These packages are in maintenance mode receiving critical bug fixes, but no new features.
+If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/), or are writing a client side browser application, we strongly encourage you to upgrade to `@azure/identity` which uses the latest versions of Azure Active Directory and MSAL APIs and provides more authentication options.
+
### How to use
-#### nodejs - Authentication, client creation and listBySubscriptionId availabilityStatuses as an example written in TypeScript.
+- If you are writing a client side browser application,
+ - Follow the instructions in the section on Authenticating client side browser applications in [Azure Identity examples](https://aka.ms/azsdk/js/identity/examples) to register your application in the Microsoft identity platform and set the right permissions.
+ - Copy the client ID and tenant ID from the Overview section of your app registration in Azure portal and use it in the browser sample below.
+- If you are writing a server side application,
+ - [Select a credential from `@azure/identity` based on the authentication method of your choice](https://aka.ms/azsdk/js/identity/examples)
+ - Complete the set up steps required by the credential if any.
+ - Use the credential you picked in the place of `DefaultAzureCredential` in the Node.js sample below.
-##### Install @azure/ms-rest-nodeauth
+In the below samples, we pass the credential and the Azure subscription id to instantiate the client.
+Once the client is created, explore the operations on it either in your favorite editor or in our [API reference documentation](https://docs.microsoft.com/javascript/api) to get started.
-```
-npm install @azure/ms-rest-nodeauth
-```
+#### nodejs - Authentication, client creation, and listBySubscriptionId availabilityStatuses as an example written in JavaScript.
##### Sample code
-```ts
-import * as msRest from "@azure/ms-rest-js";
-import * as msRestAzure from "@azure/ms-rest-azure-js";
-import * as msRestNodeAuth from "@azure/ms-rest-nodeauth";
-import { MicrosoftResourceHealth, MicrosoftResourceHealthModels, MicrosoftResourceHealthMappers } from "@azure/arm-resourcehealth";
+```javascript
+const { DefaultAzureCredential } = require("@azure/identity");
+const { MicrosoftResourceHealth } = require("@azure/arm-resourcehealth");
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
-msRestNodeAuth.interactiveLogin().then((creds) => {
- const client = new MicrosoftResourceHealth(creds, subscriptionId);
- const filter = "testfilter";
- const expand = "testexpand";
- client.availabilityStatuses.listBySubscriptionId(filter, expand).then((result) => {
- console.log("The result is:");
- console.log(result);
- });
+// Use `DefaultAzureCredential` or any other credential of your choice based on https://aka.ms/azsdk/js/identity/examples
+// Please note that you can also use credentials from the `@azure/ms-rest-nodeauth` package instead.
+const creds = new DefaultAzureCredential();
+const client = new MicrosoftResourceHealth(creds, subscriptionId);
+const filter = "testfilter";
+const expand = "testexpand";
+client.availabilityStatuses.listBySubscriptionId(filter, expand).then((result) => {
+ console.log("The result is:");
+ console.log(result);
}).catch((err) => {
+ console.log("An error occurred:");
console.error(err);
});
```
-#### browser - Authentication, client creation and listBySubscriptionId availabilityStatuses as an example written in JavaScript.
+#### browser - Authentication, client creation, and listBySubscriptionId availabilityStatuses as an example written in JavaScript.
-##### Install @azure/ms-rest-browserauth
-
-```
-npm install @azure/ms-rest-browserauth
-```
+In browser applications, we recommend using the `InteractiveBrowserCredential` that interactively authenticates using the default system browser.
+ - See [Single-page application: App registration guide](https://docs.microsoft.com/azure/active-directory/develop/scenario-spa-app-registration) to configure your app registration for the browser.
+ - Note down the client Id from the previous step and use it in the browser sample below.
##### Sample code
-See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.
-
- index.html
+
```html
@azure/arm-resourcehealth sample
-
-
+
@@ -99,5 +109,4 @@ See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to
- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js)
-
-
+
diff --git a/sdk/resourcehealth/arm-resourcehealth/package.json b/sdk/resourcehealth/arm-resourcehealth/package.json
index c8c350f2f591..c71ce10ab1c7 100644
--- a/sdk/resourcehealth/arm-resourcehealth/package.json
+++ b/sdk/resourcehealth/arm-resourcehealth/package.json
@@ -2,10 +2,11 @@
"name": "@azure/arm-resourcehealth",
"author": "Microsoft Corporation",
"description": "MicrosoftResourceHealth Library with typescript type definitions for node.js and browser.",
- "version": "1.1.0",
+ "version": "1.2.0",
"dependencies": {
- "@azure/ms-rest-azure-js": "^1.1.0",
- "@azure/ms-rest-js": "^1.1.0",
+ "@azure/ms-rest-azure-js": "^1.4.0",
+ "@azure/ms-rest-js": "^1.11.0",
+ "@azure/core-auth": "^1.1.4",
"tslib": "^1.9.3"
},
"keywords": [
@@ -20,7 +21,7 @@
"module": "./esm/microsoftResourceHealth.js",
"types": "./esm/microsoftResourceHealth.d.ts",
"devDependencies": {
- "typescript": "^3.1.1",
+ "typescript": "^3.6.0",
"rollup": "^0.66.2",
"rollup-plugin-node-resolve": "^3.4.0",
"uglify-js": "^3.4.9"
diff --git a/sdk/resourcehealth/arm-resourcehealth/src/microsoftResourceHealth.ts b/sdk/resourcehealth/arm-resourcehealth/src/microsoftResourceHealth.ts
index 07e66bbf7f91..f90ba11e05e9 100644
--- a/sdk/resourcehealth/arm-resourcehealth/src/microsoftResourceHealth.ts
+++ b/sdk/resourcehealth/arm-resourcehealth/src/microsoftResourceHealth.ts
@@ -9,6 +9,7 @@
*/
import * as msRest from "@azure/ms-rest-js";
+import { TokenCredential } from "@azure/core-auth";
import * as Models from "./models";
import * as Mappers from "./models/mappers";
import * as operations from "./operations";
@@ -22,12 +23,17 @@ class MicrosoftResourceHealth extends MicrosoftResourceHealthContext {
/**
* Initializes a new instance of the MicrosoftResourceHealth class.
- * @param credentials Credentials needed for the client to connect to Azure.
+ * @param credentials Credentials needed for the client to connect to Azure. Credentials
+ * implementing the TokenCredential interface from the @azure/identity package are recommended. For
+ * more information about these credentials, see
+ * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
+ * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
+ * @azure/ms-rest-browserauth are also supported.
* @param subscriptionId Subscription credentials which uniquely identify Microsoft Azure
* subscription. The subscription ID forms part of the URI for every service call.
* @param [options] The parameter options
*/
- constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.MicrosoftResourceHealthOptions) {
+ constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.MicrosoftResourceHealthOptions) {
super(credentials, subscriptionId, options);
this.availabilityStatuses = new operations.AvailabilityStatuses(this);
this.operations = new operations.Operations(this);
diff --git a/sdk/resourcehealth/arm-resourcehealth/src/microsoftResourceHealthContext.ts b/sdk/resourcehealth/arm-resourcehealth/src/microsoftResourceHealthContext.ts
index b5256df762bb..cecd9d155b3f 100644
--- a/sdk/resourcehealth/arm-resourcehealth/src/microsoftResourceHealthContext.ts
+++ b/sdk/resourcehealth/arm-resourcehealth/src/microsoftResourceHealthContext.ts
@@ -10,24 +10,30 @@
import * as Models from "./models";
import * as msRest from "@azure/ms-rest-js";
+import { TokenCredential } from "@azure/core-auth";
import * as msRestAzure from "@azure/ms-rest-azure-js";
const packageName = "@azure/arm-resourcehealth";
-const packageVersion = "0.1.0";
+const packageVersion = "1.2.0";
export class MicrosoftResourceHealthContext extends msRestAzure.AzureServiceClient {
- credentials: msRest.ServiceClientCredentials;
+ credentials: msRest.ServiceClientCredentials | TokenCredential;
subscriptionId: string;
apiVersion?: string;
/**
* Initializes a new instance of the MicrosoftResourceHealth class.
- * @param credentials Credentials needed for the client to connect to Azure.
+ * @param credentials Credentials needed for the client to connect to Azure. Credentials
+ * implementing the TokenCredential interface from the @azure/identity package are recommended. For
+ * more information about these credentials, see
+ * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
+ * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
+ * @azure/ms-rest-browserauth are also supported.
* @param subscriptionId Subscription credentials which uniquely identify Microsoft Azure
* subscription. The subscription ID forms part of the URI for every service call.
* @param [options] The parameter options
*/
- constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.MicrosoftResourceHealthOptions) {
+ constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.MicrosoftResourceHealthOptions) {
if (credentials == undefined) {
throw new Error('\'credentials\' cannot be null.');
}
diff --git a/sdk/resourcemover/arm-resourcemover/README.md b/sdk/resourcemover/arm-resourcemover/README.md
index 8c8f8dae2395..dd5bb7571540 100644
--- a/sdk/resourcemover/arm-resourcemover/README.md
+++ b/sdk/resourcemover/arm-resourcemover/README.md
@@ -1,93 +1,103 @@
## Azure ResourceMoverServiceAPI SDK for JavaScript
-This package contains an isomorphic SDK for ResourceMoverServiceAPI.
+This package contains an isomorphic SDK (runs both in Node.js and in browsers) for ResourceMoverServiceAPI.
### Currently supported environments
-- Node.js version 6.x.x or higher
-- Browser JavaScript
+- [LTS versions of Node.js](https://nodejs.org/about/releases/)
+- Latest versions of Safari, Chrome, Edge, and Firefox.
-### How to Install
+### Prerequisites
+You must have an [Azure subscription](https://azure.microsoft.com/free/).
+
+### How to install
+
+To use this SDK in your project, you will need to install two packages.
+- `@azure/arm-resourcemover` that contains the client.
+- `@azure/identity` that provides different mechanisms for the client to authenticate your requests using Azure Active Directory.
+
+Install both packages using the below command:
```bash
-npm install @azure/arm-resourcemover
+npm install --save @azure/arm-resourcemover @azure/identity
```
+> **Note**: You may have used either `@azure/ms-rest-nodeauth` or `@azure/ms-rest-browserauth` in the past. These packages are in maintenance mode receiving critical bug fixes, but no new features.
+If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/), or are writing a client side browser application, we strongly encourage you to upgrade to `@azure/identity` which uses the latest versions of Azure Active Directory and MSAL APIs and provides more authentication options.
+
### How to use
-#### nodejs - client creation and get moveCollections as an example written in TypeScript.
+- If you are writing a client side browser application,
+ - Follow the instructions in the section on Authenticating client side browser applications in [Azure Identity examples](https://aka.ms/azsdk/js/identity/examples) to register your application in the Microsoft identity platform and set the right permissions.
+ - Copy the client ID and tenant ID from the Overview section of your app registration in Azure portal and use it in the browser sample below.
+- If you are writing a server side application,
+ - [Select a credential from `@azure/identity` based on the authentication method of your choice](https://aka.ms/azsdk/js/identity/examples)
+ - Complete the set up steps required by the credential if any.
+ - Use the credential you picked in the place of `DefaultAzureCredential` in the Node.js sample below.
-##### Install @azure/ms-rest-nodeauth
+In the below samples, we pass the credential and the Azure subscription id to instantiate the client.
+Once the client is created, explore the operations on it either in your favorite editor or in our [API reference documentation](https://docs.microsoft.com/javascript/api) to get started.
-- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`.
-```bash
-npm install @azure/ms-rest-nodeauth@"^3.0.0"
-```
+#### nodejs - Authentication, client creation, and get moveCollections as an example written in JavaScript.
##### Sample code
-While the below sample uses the interactive login, other authentication options can be found in the [README.md file of @azure/ms-rest-nodeauth](https://www.npmjs.com/package/@azure/ms-rest-nodeauth) package
-```typescript
-const msRestNodeAuth = require("@azure/ms-rest-nodeauth");
+```javascript
+const { DefaultAzureCredential } = require("@azure/identity");
const { ResourceMoverServiceAPI } = require("@azure/arm-resourcemover");
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
-msRestNodeAuth.interactiveLogin().then((creds) => {
- const client = new ResourceMoverServiceAPI(creds, subscriptionId);
- const resourceGroupName = "testresourceGroupName";
- const moveCollectionName = "testmoveCollectionName";
- client.moveCollections.get(resourceGroupName, moveCollectionName).then((result) => {
- console.log("The result is:");
- console.log(result);
- });
+// Use `DefaultAzureCredential` or any other credential of your choice based on https://aka.ms/azsdk/js/identity/examples
+// Please note that you can also use credentials from the `@azure/ms-rest-nodeauth` package instead.
+const creds = new DefaultAzureCredential();
+const client = new ResourceMoverServiceAPI(creds, subscriptionId);
+const resourceGroupName = "testresourceGroupName";
+const moveCollectionName = "testmoveCollectionName";
+client.moveCollections.get(resourceGroupName, moveCollectionName).then((result) => {
+ console.log("The result is:");
+ console.log(result);
}).catch((err) => {
+ console.log("An error occurred:");
console.error(err);
});
```
-#### browser - Authentication, client creation and get moveCollections as an example written in JavaScript.
+#### browser - Authentication, client creation, and get moveCollections as an example written in JavaScript.
-##### Install @azure/ms-rest-browserauth
-
-```bash
-npm install @azure/ms-rest-browserauth
-```
+In browser applications, we recommend using the `InteractiveBrowserCredential` that interactively authenticates using the default system browser.
+ - See [Single-page application: App registration guide](https://docs.microsoft.com/azure/active-directory/develop/scenario-spa-app-registration) to configure your app registration for the browser.
+ - Note down the client Id from the previous step and use it in the browser sample below.
##### Sample code
-See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.
-
- index.html
+
```html
@azure/arm-resourcemover sample
-
-
+
diff --git a/sdk/resourcemover/arm-resourcemover/package.json b/sdk/resourcemover/arm-resourcemover/package.json
index 08acdd8be900..d5e754f45a52 100644
--- a/sdk/resourcemover/arm-resourcemover/package.json
+++ b/sdk/resourcemover/arm-resourcemover/package.json
@@ -2,10 +2,11 @@
"name": "@azure/arm-resourcemover",
"author": "Microsoft Corporation",
"description": "ResourceMoverServiceAPI Library with typescript type definitions for node.js and browser.",
- "version": "1.0.0",
+ "version": "1.1.0",
"dependencies": {
- "@azure/ms-rest-azure-js": "^2.0.1",
- "@azure/ms-rest-js": "^2.0.4",
+ "@azure/ms-rest-azure-js": "^2.1.0",
+ "@azure/ms-rest-js": "^2.2.0",
+ "@azure/core-auth": "^1.1.4",
"tslib": "^1.10.0"
},
"keywords": [
@@ -20,7 +21,7 @@
"module": "./esm/resourceMoverServiceAPI.js",
"types": "./esm/resourceMoverServiceAPI.d.ts",
"devDependencies": {
- "typescript": "^3.5.3",
+ "typescript": "^3.6.0",
"rollup": "^1.18.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-sourcemaps": "^0.4.2",
diff --git a/sdk/resourcemover/arm-resourcemover/src/resourceMoverServiceAPI.ts b/sdk/resourcemover/arm-resourcemover/src/resourceMoverServiceAPI.ts
index 4733943ad50f..42dc7b8b6bf0 100644
--- a/sdk/resourcemover/arm-resourcemover/src/resourceMoverServiceAPI.ts
+++ b/sdk/resourcemover/arm-resourcemover/src/resourceMoverServiceAPI.ts
@@ -8,6 +8,7 @@
*/
import * as msRest from "@azure/ms-rest-js";
+import { TokenCredential } from "@azure/core-auth";
import * as Models from "./models";
import * as Mappers from "./models/mappers";
import * as operations from "./operations";
@@ -23,11 +24,16 @@ class ResourceMoverServiceAPI extends ResourceMoverServiceAPIContext {
/**
* Initializes a new instance of the ResourceMoverServiceAPI class.
- * @param credentials Credentials needed for the client to connect to Azure.
+ * @param credentials Credentials needed for the client to connect to Azure. Credentials
+ * implementing the TokenCredential interface from the @azure/identity package are recommended. For
+ * more information about these credentials, see
+ * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
+ * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
+ * @azure/ms-rest-browserauth are also supported.
* @param subscriptionId The Subscription ID.
* @param [options] The parameter options
*/
- constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.ResourceMoverServiceAPIOptions) {
+ constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.ResourceMoverServiceAPIOptions) {
super(credentials, subscriptionId, options);
this.moveCollections = new operations.MoveCollections(this);
this.moveResources = new operations.MoveResources(this);
diff --git a/sdk/resourcemover/arm-resourcemover/src/resourceMoverServiceAPIContext.ts b/sdk/resourcemover/arm-resourcemover/src/resourceMoverServiceAPIContext.ts
index 8243af0fc771..72dd8d45bcfe 100644
--- a/sdk/resourcemover/arm-resourcemover/src/resourceMoverServiceAPIContext.ts
+++ b/sdk/resourcemover/arm-resourcemover/src/resourceMoverServiceAPIContext.ts
@@ -9,23 +9,29 @@
import * as Models from "./models";
import * as msRest from "@azure/ms-rest-js";
+import { TokenCredential } from "@azure/core-auth";
import * as msRestAzure from "@azure/ms-rest-azure-js";
const packageName = "@azure/arm-resourcemover";
-const packageVersion = "1.0.0";
+const packageVersion = "1.1.0";
export class ResourceMoverServiceAPIContext extends msRestAzure.AzureServiceClient {
- credentials: msRest.ServiceClientCredentials;
+ credentials: msRest.ServiceClientCredentials | TokenCredential;
subscriptionId: string;
apiVersion?: string;
/**
* Initializes a new instance of the ResourceMoverServiceAPI class.
- * @param credentials Credentials needed for the client to connect to Azure.
+ * @param credentials Credentials needed for the client to connect to Azure. Credentials
+ * implementing the TokenCredential interface from the @azure/identity package are recommended. For
+ * more information about these credentials, see
+ * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
+ * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
+ * @azure/ms-rest-browserauth are also supported.
* @param subscriptionId The Subscription ID.
* @param [options] The parameter options
*/
- constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.ResourceMoverServiceAPIOptions) {
+ constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.ResourceMoverServiceAPIOptions) {
if (credentials == undefined) {
throw new Error('\'credentials\' cannot be null.');
}
diff --git a/sdk/resources/arm-resources-profile-2020-09-01-hybrid/README.md b/sdk/resources/arm-resources-profile-2020-09-01-hybrid/README.md
index a1247d73f7a3..9019594e7ba2 100644
--- a/sdk/resources/arm-resources-profile-2020-09-01-hybrid/README.md
+++ b/sdk/resources/arm-resources-profile-2020-09-01-hybrid/README.md
@@ -1,90 +1,100 @@
## Azure ResourceManagementClient SDK for JavaScript
-This package contains an isomorphic SDK for ResourceManagementClient.
+This package contains an isomorphic SDK (runs both in Node.js and in browsers) for ResourceManagementClient.
### Currently supported environments
-- Node.js version 6.x.x or higher
-- Browser JavaScript
+- [LTS versions of Node.js](https://nodejs.org/about/releases/)
+- Latest versions of Safari, Chrome, Edge, and Firefox.
-### How to Install
+### Prerequisites
+You must have an [Azure subscription](https://azure.microsoft.com/free/).
+
+### How to install
+
+To use this SDK in your project, you will need to install two packages.
+- `@azure/arm-resources-profile-2020-09-01-hybrid` that contains the client.
+- `@azure/identity` that provides different mechanisms for the client to authenticate your requests using Azure Active Directory.
+
+Install both packages using the below command:
```bash
-npm install @azure/arm-resources-profile-2020-09-01-hybrid
+npm install --save @azure/arm-resources-profile-2020-09-01-hybrid @azure/identity
```
+> **Note**: You may have used either `@azure/ms-rest-nodeauth` or `@azure/ms-rest-browserauth` in the past. These packages are in maintenance mode receiving critical bug fixes, but no new features.
+If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/), or are writing a client side browser application, we strongly encourage you to upgrade to `@azure/identity` which uses the latest versions of Azure Active Directory and MSAL APIs and provides more authentication options.
+
### How to use
-#### nodejs - Authentication, client creation and list operations as an example written in TypeScript.
+- If you are writing a client side browser application,
+ - Follow the instructions in the section on Authenticating client side browser applications in [Azure Identity examples](https://aka.ms/azsdk/js/identity/examples) to register your application in the Microsoft identity platform and set the right permissions.
+ - Copy the client ID and tenant ID from the Overview section of your app registration in Azure portal and use it in the browser sample below.
+- If you are writing a server side application,
+ - [Select a credential from `@azure/identity` based on the authentication method of your choice](https://aka.ms/azsdk/js/identity/examples)
+ - Complete the set up steps required by the credential if any.
+ - Use the credential you picked in the place of `DefaultAzureCredential` in the Node.js sample below.
-##### Install @azure/ms-rest-nodeauth
+In the below samples, we pass the credential and the Azure subscription id to instantiate the client.
+Once the client is created, explore the operations on it either in your favorite editor or in our [API reference documentation](https://docs.microsoft.com/javascript/api) to get started.
-- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`.
-```bash
-npm install @azure/ms-rest-nodeauth@"^3.0.0"
-```
+#### nodejs - Authentication, client creation, and list operations as an example written in JavaScript.
##### Sample code
-```typescript
-import * as msRest from "@azure/ms-rest-js";
-import * as msRestAzure from "@azure/ms-rest-azure-js";
-import * as msRestNodeAuth from "@azure/ms-rest-nodeauth";
-import { ResourceManagementClient, ResourceManagementModels, ResourceManagementMappers } from "@azure/arm-resources-profile-2020-09-01-hybrid";
+```javascript
+const { DefaultAzureCredential } = require("@azure/identity");
+const { ResourceManagementClient } = require("@azure/arm-resources-profile-2020-09-01-hybrid");
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
-msRestNodeAuth.interactiveLogin().then((creds) => {
- const client = new ResourceManagementClient(creds, subscriptionId);
- client.operations.list().then((result) => {
- console.log("The result is:");
- console.log(result);
- });
+// Use `DefaultAzureCredential` or any other credential of your choice based on https://aka.ms/azsdk/js/identity/examples
+// Please note that you can also use credentials from the `@azure/ms-rest-nodeauth` package instead.
+const creds = new DefaultAzureCredential();
+const client = new ResourceManagementClient(creds, subscriptionId);
+
+client.operations.list().then((result) => {
+ console.log("The result is:");
+ console.log(result);
}).catch((err) => {
+ console.log("An error occurred:");
console.error(err);
});
```
-#### browser - Authentication, client creation and list operations as an example written in JavaScript.
-
-##### Install @azure/ms-rest-browserauth
+#### browser - Authentication, client creation, and list operations as an example written in JavaScript.
-```bash
-npm install @azure/ms-rest-browserauth
-```
+In browser applications, we recommend using the `InteractiveBrowserCredential` that interactively authenticates using the default system browser.
+ - See [Single-page application: App registration guide](https://docs.microsoft.com/azure/active-directory/develop/scenario-spa-app-registration) to configure your app registration for the browser.
+ - Note down the client Id from the previous step and use it in the browser sample below.
##### Sample code
-See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.
-
- index.html
+
```html
@azure/arm-resources-profile-2020-09-01-hybrid sample
-
-
+
diff --git a/sdk/resources/arm-resources-profile-2020-09-01-hybrid/package.json b/sdk/resources/arm-resources-profile-2020-09-01-hybrid/package.json
index 11a1d2d24f63..08049fb65cee 100644
--- a/sdk/resources/arm-resources-profile-2020-09-01-hybrid/package.json
+++ b/sdk/resources/arm-resources-profile-2020-09-01-hybrid/package.json
@@ -2,10 +2,11 @@
"name": "@azure/arm-resources-profile-2020-09-01-hybrid",
"author": "Microsoft Corporation",
"description": "ResourceManagementClient Library with typescript type definitions for node.js and browser.",
- "version": "1.0.0",
+ "version": "1.1.0",
"dependencies": {
- "@azure/ms-rest-azure-js": "^2.0.1",
- "@azure/ms-rest-js": "^2.0.4",
+ "@azure/ms-rest-azure-js": "^2.1.0",
+ "@azure/ms-rest-js": "^2.2.0",
+ "@azure/core-auth": "^1.1.4",
"tslib": "^1.10.0"
},
"keywords": [
@@ -20,7 +21,7 @@
"module": "./esm/resourceManagementClient.js",
"types": "./esm/resourceManagementClient.d.ts",
"devDependencies": {
- "typescript": "^3.5.3",
+ "typescript": "^3.6.0",
"rollup": "^1.18.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-sourcemaps": "^0.4.2",
diff --git a/sdk/resources/arm-resources-profile-2020-09-01-hybrid/src/resourceManagementClient.ts b/sdk/resources/arm-resources-profile-2020-09-01-hybrid/src/resourceManagementClient.ts
index 535cd08e4b20..1f14526530af 100644
--- a/sdk/resources/arm-resources-profile-2020-09-01-hybrid/src/resourceManagementClient.ts
+++ b/sdk/resources/arm-resources-profile-2020-09-01-hybrid/src/resourceManagementClient.ts
@@ -9,6 +9,7 @@
*/
import * as msRest from "@azure/ms-rest-js";
+import { TokenCredential } from "@azure/core-auth";
import * as Models from "./models";
import * as Mappers from "./models/mappers";
import * as operations from "./operations";
@@ -27,11 +28,16 @@ class ResourceManagementClient extends ResourceManagementClientContext {
/**
* Initializes a new instance of the ResourceManagementClient class.
- * @param credentials Credentials needed for the client to connect to Azure.
+ * @param credentials Credentials needed for the client to connect to Azure. Credentials
+ * implementing the TokenCredential interface from the @azure/identity package are recommended. For
+ * more information about these credentials, see
+ * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
+ * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
+ * @azure/ms-rest-browserauth are also supported.
* @param subscriptionId The ID of the target subscription.
* @param [options] The parameter options
*/
- constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.ResourceManagementClientOptions) {
+ constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.ResourceManagementClientOptions) {
super(credentials, subscriptionId, options);
this.operations = new operations.Operations(this);
this.deployments = new operations.Deployments(this);
diff --git a/sdk/resources/arm-resources-profile-2020-09-01-hybrid/src/resourceManagementClientContext.ts b/sdk/resources/arm-resources-profile-2020-09-01-hybrid/src/resourceManagementClientContext.ts
index d51108b522e1..92ef7b4bcf50 100644
--- a/sdk/resources/arm-resources-profile-2020-09-01-hybrid/src/resourceManagementClientContext.ts
+++ b/sdk/resources/arm-resources-profile-2020-09-01-hybrid/src/resourceManagementClientContext.ts
@@ -10,23 +10,29 @@
import * as Models from "./models";
import * as msRest from "@azure/ms-rest-js";
+import { TokenCredential } from "@azure/core-auth";
import * as msRestAzure from "@azure/ms-rest-azure-js";
const packageName = "@azure/arm-resources-profile-2020-09-01-hybrid";
-const packageVersion = "1.0.0";
+const packageVersion = "1.1.0";
export class ResourceManagementClientContext extends msRestAzure.AzureServiceClient {
- credentials: msRest.ServiceClientCredentials;
+ credentials: msRest.ServiceClientCredentials | TokenCredential;
subscriptionId: string;
apiVersion?: string;
/**
* Initializes a new instance of the ResourceManagementClient class.
- * @param credentials Credentials needed for the client to connect to Azure.
+ * @param credentials Credentials needed for the client to connect to Azure. Credentials
+ * implementing the TokenCredential interface from the @azure/identity package are recommended. For
+ * more information about these credentials, see
+ * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
+ * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
+ * @azure/ms-rest-browserauth are also supported.
* @param subscriptionId The ID of the target subscription.
* @param [options] The parameter options
*/
- constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.ResourceManagementClientOptions) {
+ constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.ResourceManagementClientOptions) {
if (credentials == undefined) {
throw new Error('\'credentials\' cannot be null.');
}
diff --git a/sdk/resources/arm-resources-profile-hybrid-2019-03-01/README.md b/sdk/resources/arm-resources-profile-hybrid-2019-03-01/README.md
index 0fdd24721776..9d60302dadf4 100644
--- a/sdk/resources/arm-resources-profile-hybrid-2019-03-01/README.md
+++ b/sdk/resources/arm-resources-profile-hybrid-2019-03-01/README.md
@@ -1,89 +1,100 @@
## Azure ResourceManagementClient SDK for JavaScript
-This package contains an isomorphic SDK for ResourceManagementClient.
+This package contains an isomorphic SDK (runs both in Node.js and in browsers) for ResourceManagementClient.
### Currently supported environments
-- Node.js version 6.x.x or higher
-- Browser JavaScript
+- [LTS versions of Node.js](https://nodejs.org/about/releases/)
+- Latest versions of Safari, Chrome, Edge, and Firefox.
-### How to Install
+### Prerequisites
+You must have an [Azure subscription](https://azure.microsoft.com/free/).
+
+### How to install
+
+To use this SDK in your project, you will need to install two packages.
+- `@azure/arm-resources-profile-hybrid-2019-03-01` that contains the client.
+- `@azure/identity` that provides different mechanisms for the client to authenticate your requests using Azure Active Directory.
+
+Install both packages using the below command:
```bash
-npm install @azure/arm-resources-profile-hybrid-2019-03-01
+npm install --save @azure/arm-resources-profile-hybrid-2019-03-01 @azure/identity
```
+> **Note**: You may have used either `@azure/ms-rest-nodeauth` or `@azure/ms-rest-browserauth` in the past. These packages are in maintenance mode receiving critical bug fixes, but no new features.
+If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/), or are writing a client side browser application, we strongly encourage you to upgrade to `@azure/identity` which uses the latest versions of Azure Active Directory and MSAL APIs and provides more authentication options.
+
### How to use
-#### nodejs - Authentication, client creation and list operations as an example written in TypeScript.
+- If you are writing a client side browser application,
+ - Follow the instructions in the section on Authenticating client side browser applications in [Azure Identity examples](https://aka.ms/azsdk/js/identity/examples) to register your application in the Microsoft identity platform and set the right permissions.
+ - Copy the client ID and tenant ID from the Overview section of your app registration in Azure portal and use it in the browser sample below.
+- If you are writing a server side application,
+ - [Select a credential from `@azure/identity` based on the authentication method of your choice](https://aka.ms/azsdk/js/identity/examples)
+ - Complete the set up steps required by the credential if any.
+ - Use the credential you picked in the place of `DefaultAzureCredential` in the Node.js sample below.
-##### Install @azure/ms-rest-nodeauth
+In the below samples, we pass the credential and the Azure subscription id to instantiate the client.
+Once the client is created, explore the operations on it either in your favorite editor or in our [API reference documentation](https://docs.microsoft.com/javascript/api) to get started.
-```bash
-npm install @azure/ms-rest-nodeauth
-```
+#### nodejs - Authentication, client creation, and list operations as an example written in JavaScript.
##### Sample code
-```typescript
-import * as msRest from "@azure/ms-rest-js";
-import * as msRestAzure from "@azure/ms-rest-azure-js";
-import * as msRestNodeAuth from "@azure/ms-rest-nodeauth";
-import { ResourceManagementClient, ResourceManagementModels, ResourceManagementMappers } from "@azure/arm-resources-profile-hybrid-2019-03-01";
+```javascript
+const { DefaultAzureCredential } = require("@azure/identity");
+const { ResourceManagementClient } = require("@azure/arm-resources-profile-hybrid-2019-03-01");
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
-msRestNodeAuth.interactiveLogin().then((creds) => {
- const client = new ResourceManagementClient(creds, subscriptionId);
- client.operations.list().then((result) => {
- console.log("The result is:");
- console.log(result);
- });
+// Use `DefaultAzureCredential` or any other credential of your choice based on https://aka.ms/azsdk/js/identity/examples
+// Please note that you can also use credentials from the `@azure/ms-rest-nodeauth` package instead.
+const creds = new DefaultAzureCredential();
+const client = new ResourceManagementClient(creds, subscriptionId);
+
+client.operations.list().then((result) => {
+ console.log("The result is:");
+ console.log(result);
}).catch((err) => {
+ console.log("An error occurred:");
console.error(err);
});
```
-#### browser - Authentication, client creation and list operations as an example written in JavaScript.
+#### browser - Authentication, client creation, and list operations as an example written in JavaScript.
-##### Install @azure/ms-rest-browserauth
-
-```bash
-npm install @azure/ms-rest-browserauth
-```
+In browser applications, we recommend using the `InteractiveBrowserCredential` that interactively authenticates using the default system browser.
+ - See [Single-page application: App registration guide](https://docs.microsoft.com/azure/active-directory/develop/scenario-spa-app-registration) to configure your app registration for the browser.
+ - Note down the client Id from the previous step and use it in the browser sample below.
##### Sample code
-See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.
-
- index.html
+
```html
@azure/arm-resources-profile-hybrid-2019-03-01 sample
-
-
+
@@ -95,5 +106,4 @@ See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to
- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js)
-
-
+
diff --git a/sdk/resources/arm-resources-profile-hybrid-2019-03-01/package.json b/sdk/resources/arm-resources-profile-hybrid-2019-03-01/package.json
index a114ebb9b805..18a300bf6dbb 100644
--- a/sdk/resources/arm-resources-profile-hybrid-2019-03-01/package.json
+++ b/sdk/resources/arm-resources-profile-hybrid-2019-03-01/package.json
@@ -2,10 +2,11 @@
"name": "@azure/arm-resources-profile-hybrid-2019-03-01",
"author": "Microsoft Corporation",
"description": "ResourceManagementClient Library with typescript type definitions for node.js and browser.",
- "version": "1.0.0",
+ "version": "1.1.0",
"dependencies": {
- "@azure/ms-rest-azure-js": "^1.3.2",
- "@azure/ms-rest-js": "^1.8.1",
+ "@azure/ms-rest-azure-js": "^1.4.0",
+ "@azure/ms-rest-js": "^1.11.0",
+ "@azure/core-auth": "^1.1.4",
"tslib": "^1.9.3"
},
"keywords": [
@@ -21,7 +22,7 @@
"module": "./esm/resourceManagementClient.js",
"types": "./esm/resourceManagementClient.d.ts",
"devDependencies": {
- "typescript": "^3.1.1",
+ "typescript": "^3.6.0",
"rollup": "^0.66.2",
"rollup-plugin-node-resolve": "^3.4.0",
"rollup-plugin-sourcemaps": "^0.4.2",
diff --git a/sdk/resources/arm-resources-profile-hybrid-2019-03-01/src/resourceManagementClient.ts b/sdk/resources/arm-resources-profile-hybrid-2019-03-01/src/resourceManagementClient.ts
index b712764c2a93..bae69b68006d 100644
--- a/sdk/resources/arm-resources-profile-hybrid-2019-03-01/src/resourceManagementClient.ts
+++ b/sdk/resources/arm-resources-profile-hybrid-2019-03-01/src/resourceManagementClient.ts
@@ -9,6 +9,7 @@
*/
import * as msRest from "@azure/ms-rest-js";
+import { TokenCredential } from "@azure/core-auth";
import * as Models from "./models";
import * as Mappers from "./models/mappers";
import * as operations from "./operations";
@@ -27,11 +28,16 @@ class ResourceManagementClient extends ResourceManagementClientContext {
/**
* Initializes a new instance of the ResourceManagementClient class.
- * @param credentials Credentials needed for the client to connect to Azure.
+ * @param credentials Credentials needed for the client to connect to Azure. Credentials
+ * implementing the TokenCredential interface from the @azure/identity package are recommended. For
+ * more information about these credentials, see
+ * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
+ * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
+ * @azure/ms-rest-browserauth are also supported.
* @param subscriptionId The ID of the target subscription.
* @param [options] The parameter options
*/
- constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.ResourceManagementClientOptions) {
+ constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.ResourceManagementClientOptions) {
super(credentials, subscriptionId, options);
this.operations = new operations.Operations(this);
this.deployments = new operations.Deployments(this);
diff --git a/sdk/resources/arm-resources-profile-hybrid-2019-03-01/src/resourceManagementClientContext.ts b/sdk/resources/arm-resources-profile-hybrid-2019-03-01/src/resourceManagementClientContext.ts
index 4ab26206226d..fc0412712c0a 100644
--- a/sdk/resources/arm-resources-profile-hybrid-2019-03-01/src/resourceManagementClientContext.ts
+++ b/sdk/resources/arm-resources-profile-hybrid-2019-03-01/src/resourceManagementClientContext.ts
@@ -10,23 +10,29 @@
import * as Models from "./models";
import * as msRest from "@azure/ms-rest-js";
+import { TokenCredential } from "@azure/core-auth";
import * as msRestAzure from "@azure/ms-rest-azure-js";
const packageName = "@azure/arm-resources-profile-hybrid-2019-03-01";
-const packageVersion = "1.0.0";
+const packageVersion = "1.1.0";
export class ResourceManagementClientContext extends msRestAzure.AzureServiceClient {
- credentials: msRest.ServiceClientCredentials;
+ credentials: msRest.ServiceClientCredentials | TokenCredential;
subscriptionId: string;
apiVersion?: string;
/**
* Initializes a new instance of the ResourceManagementClient class.
- * @param credentials Credentials needed for the client to connect to Azure.
+ * @param credentials Credentials needed for the client to connect to Azure. Credentials
+ * implementing the TokenCredential interface from the @azure/identity package are recommended. For
+ * more information about these credentials, see
+ * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
+ * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
+ * @azure/ms-rest-browserauth are also supported.
* @param subscriptionId The ID of the target subscription.
* @param [options] The parameter options
*/
- constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.ResourceManagementClientOptions) {
+ constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.ResourceManagementClientOptions) {
if (credentials == undefined) {
throw new Error('\'credentials\' cannot be null.');
}
diff --git a/sdk/search/arm-search/README.md b/sdk/search/arm-search/README.md
index 8a1589580eac..159fd0119ef9 100644
--- a/sdk/search/arm-search/README.md
+++ b/sdk/search/arm-search/README.md
@@ -1,89 +1,100 @@
## Azure SearchManagementClient SDK for JavaScript
-This package contains an isomorphic SDK for SearchManagementClient.
+This package contains an isomorphic SDK (runs both in Node.js and in browsers) for SearchManagementClient.
### Currently supported environments
-- Node.js version 6.x.x or higher
-- Browser JavaScript
+- [LTS versions of Node.js](https://nodejs.org/about/releases/)
+- Latest versions of Safari, Chrome, Edge, and Firefox.
-### How to Install
+### Prerequisites
-```
-npm install @azure/arm-search
+You must have an [Azure subscription](https://azure.microsoft.com/free/).
+
+### How to install
+
+To use this SDK in your project, you will need to install two packages.
+- `@azure/arm-search` that contains the client.
+- `@azure/identity` that provides different mechanisms for the client to authenticate your requests using Azure Active Directory.
+
+Install both packages using the below command:
+```bash
+npm install --save @azure/arm-search @azure/identity
```
+> **Note**: You may have used either `@azure/ms-rest-nodeauth` or `@azure/ms-rest-browserauth` in the past. These packages are in maintenance mode receiving critical bug fixes, but no new features.
+If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/), or are writing a client side browser application, we strongly encourage you to upgrade to `@azure/identity` which uses the latest versions of Azure Active Directory and MSAL APIs and provides more authentication options.
+
### How to use
-#### nodejs - Authentication, client creation and list operations as an example written in TypeScript.
+- If you are writing a client side browser application,
+ - Follow the instructions in the section on Authenticating client side browser applications in [Azure Identity examples](https://aka.ms/azsdk/js/identity/examples) to register your application in the Microsoft identity platform and set the right permissions.
+ - Copy the client ID and tenant ID from the Overview section of your app registration in Azure portal and use it in the browser sample below.
+- If you are writing a server side application,
+ - [Select a credential from `@azure/identity` based on the authentication method of your choice](https://aka.ms/azsdk/js/identity/examples)
+ - Complete the set up steps required by the credential if any.
+ - Use the credential you picked in the place of `DefaultAzureCredential` in the Node.js sample below.
-##### Install @azure/ms-rest-nodeauth
+In the below samples, we pass the credential and the Azure subscription id to instantiate the client.
+Once the client is created, explore the operations on it either in your favorite editor or in our [API reference documentation](https://docs.microsoft.com/javascript/api) to get started.
-```
-npm install @azure/ms-rest-nodeauth
-```
+#### nodejs - Authentication, client creation, and list operations as an example written in JavaScript.
##### Sample code
-```ts
-import * as msRest from "@azure/ms-rest-js";
-import * as msRestAzure from "@azure/ms-rest-azure-js";
-import * as msRestNodeAuth from "@azure/ms-rest-nodeauth";
-import { SearchManagementClient, SearchManagementModels, SearchManagementMappers } from "@azure/arm-search";
+```javascript
+const { DefaultAzureCredential } = require("@azure/identity");
+const { SearchManagementClient } = require("@azure/arm-search");
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
-msRestNodeAuth.interactiveLogin().then((creds) => {
- const client = new SearchManagementClient(creds, subscriptionId);
- client.operations.list().then((result) => {
- console.log("The result is:");
- console.log(result);
- });
+// Use `DefaultAzureCredential` or any other credential of your choice based on https://aka.ms/azsdk/js/identity/examples
+// Please note that you can also use credentials from the `@azure/ms-rest-nodeauth` package instead.
+const creds = new DefaultAzureCredential();
+const client = new SearchManagementClient(creds, subscriptionId);
+
+client.operations.list().then((result) => {
+ console.log("The result is:");
+ console.log(result);
}).catch((err) => {
+ console.log("An error occurred:");
console.error(err);
});
```
-#### browser - Authentication, client creation and list operations as an example written in JavaScript.
-
-##### Install @azure/ms-rest-browserauth
+#### browser - Authentication, client creation, and list operations as an example written in JavaScript.
-```
-npm install @azure/ms-rest-browserauth
-```
+In browser applications, we recommend using the `InteractiveBrowserCredential` that interactively authenticates using the default system browser.
+ - See [Single-page application: App registration guide](https://docs.microsoft.com/azure/active-directory/develop/scenario-spa-app-registration) to configure your app registration for the browser.
+ - Note down the client Id from the previous step and use it in the browser sample below.
##### Sample code
-See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.
-
- index.html
+
```html
@azure/arm-search sample
-
-
+
@@ -95,5 +106,4 @@ See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to
- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js)
-
-
+
diff --git a/sdk/search/arm-search/package.json b/sdk/search/arm-search/package.json
index e805e27ce74a..fb90a3506f66 100644
--- a/sdk/search/arm-search/package.json
+++ b/sdk/search/arm-search/package.json
@@ -2,10 +2,11 @@
"name": "@azure/arm-search",
"author": "Microsoft Corporation",
"description": "SearchManagementClient Library with typescript type definitions for node.js and browser.",
- "version": "1.3.0",
+ "version": "1.4.0",
"dependencies": {
- "@azure/ms-rest-azure-js": "^1.1.0",
- "@azure/ms-rest-js": "^1.1.0",
+ "@azure/ms-rest-azure-js": "^1.4.0",
+ "@azure/ms-rest-js": "^1.11.0",
+ "@azure/core-auth": "^1.1.4",
"tslib": "^1.9.3"
},
"keywords": [
@@ -20,7 +21,7 @@
"module": "./esm/searchManagementClient.js",
"types": "./esm/searchManagementClient.d.ts",
"devDependencies": {
- "typescript": "^3.1.1",
+ "typescript": "^3.6.0",
"rollup": "^0.66.2",
"rollup-plugin-node-resolve": "^3.4.0",
"uglify-js": "^3.4.9"
diff --git a/sdk/search/arm-search/src/searchManagementClient.ts b/sdk/search/arm-search/src/searchManagementClient.ts
index bbdfc8a0aa13..f103244dae59 100644
--- a/sdk/search/arm-search/src/searchManagementClient.ts
+++ b/sdk/search/arm-search/src/searchManagementClient.ts
@@ -9,6 +9,7 @@
*/
import * as msRest from "@azure/ms-rest-js";
+import { TokenCredential } from "@azure/core-auth";
import * as Models from "./models";
import * as Mappers from "./models/mappers";
import * as operations from "./operations";
@@ -24,12 +25,17 @@ class SearchManagementClient extends SearchManagementClientContext {
/**
* Initializes a new instance of the SearchManagementClient class.
- * @param credentials Credentials needed for the client to connect to Azure.
+ * @param credentials Credentials needed for the client to connect to Azure. Credentials
+ * implementing the TokenCredential interface from the @azure/identity package are recommended. For
+ * more information about these credentials, see
+ * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
+ * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
+ * @azure/ms-rest-browserauth are also supported.
* @param subscriptionId The unique identifier for a Microsoft Azure subscription. You can obtain
* this value from the Azure Resource Manager API or the portal.
* @param [options] The parameter options
*/
- constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.SearchManagementClientOptions) {
+ constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.SearchManagementClientOptions) {
super(credentials, subscriptionId, options);
this.operations = new operations.Operations(this);
this.adminKeys = new operations.AdminKeys(this);
diff --git a/sdk/search/arm-search/src/searchManagementClientContext.ts b/sdk/search/arm-search/src/searchManagementClientContext.ts
index ab46edfae202..32e5508eb276 100644
--- a/sdk/search/arm-search/src/searchManagementClientContext.ts
+++ b/sdk/search/arm-search/src/searchManagementClientContext.ts
@@ -10,24 +10,30 @@
import * as Models from "./models";
import * as msRest from "@azure/ms-rest-js";
+import { TokenCredential } from "@azure/core-auth";
import * as msRestAzure from "@azure/ms-rest-azure-js";
const packageName = "@azure/arm-search";
-const packageVersion = "0.1.0";
+const packageVersion = "1.4.0";
export class SearchManagementClientContext extends msRestAzure.AzureServiceClient {
- credentials: msRest.ServiceClientCredentials;
+ credentials: msRest.ServiceClientCredentials | TokenCredential;
subscriptionId: string;
apiVersion?: string;
/**
* Initializes a new instance of the SearchManagementClient class.
- * @param credentials Credentials needed for the client to connect to Azure.
+ * @param credentials Credentials needed for the client to connect to Azure. Credentials
+ * implementing the TokenCredential interface from the @azure/identity package are recommended. For
+ * more information about these credentials, see
+ * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
+ * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
+ * @azure/ms-rest-browserauth are also supported.
* @param subscriptionId The unique identifier for a Microsoft Azure subscription. You can obtain
* this value from the Azure Resource Manager API or the portal.
* @param [options] The parameter options
*/
- constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.SearchManagementClientOptions) {
+ constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.SearchManagementClientOptions) {
if (credentials == undefined) {
throw new Error('\'credentials\' cannot be null.');
}