|
1 | | -# Azure StorageManagementClient SDK for JavaScript |
2 | | -This package contains an isomorphic SDK for StorageManagementClient. |
3 | | - |
4 | | -## Currently supported environments |
5 | | -- Node.js version 6.x.x or higher |
6 | | -- Browser JavaScript |
7 | | - |
8 | | -## How to Install |
9 | | -``` |
10 | | -npm install @azure/arm-storage |
11 | | -``` |
12 | | - |
13 | | - |
14 | | -## How to use |
15 | | - |
16 | | -### nodejs - Authentication, client creation and list operations as an example written in TypeScript. |
17 | | - |
18 | | -```ts |
19 | | -import * as msRest from "ms-rest-js"; |
20 | | -import * as msRestAzure from "ms-rest-azure-js"; |
21 | | -import * as msRestNodeAuth from "ms-rest-nodeauth"; |
22 | | -import { StorageManagementClient, StorageManagementModels, StorageManagementMappers } from "@azure/arm-storage"; |
23 | | -const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; |
24 | | - |
25 | | -msRestNodeAuth.interactiveLogin().then((creds) => { |
26 | | - const client = new StorageManagementClient(creds, subscriptionId); |
27 | | - client.operations.list().then((result) => { |
28 | | - console.log("The result is:"); |
29 | | - console.log(result); |
30 | | - }); |
31 | | -}).catch((err) => { |
32 | | - console.error(err); |
33 | | -}); |
34 | | -``` |
35 | | - |
36 | | -### browser - Authentication, client creation and list operations as an example written in JavaScript. |
37 | | -See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser. |
38 | | - |
39 | | -- index.html |
40 | | -```html |
41 | | -<!DOCTYPE html> |
42 | | -<html lang="en"> |
43 | | - <head> |
44 | | - <title>@azure/arm-storage sample</title> |
45 | | - <script src="node_modules/ms-rest-js/dist/msRest.browser.js"></script> |
46 | | - <script src="node_modules/ms-rest-azure-js/dist/msRestAzure.js"></script> |
47 | | - <script src="node_modules/ms-rest-browserauth/dist/msAuth.js"></script> |
48 | | - <script src="node_modules/@azure/arm-storage/dist/arm-storage.js"></script> |
49 | | - <script> |
50 | | - const subscriptionId = "<Subscription_Id>"; |
51 | | - const authManager = new msAuth.AuthManager({ |
52 | | - clientId: "<client id for your Azure AD app>", |
53 | | - tenant: "<optional tenant for your organization>" |
54 | | - }); |
55 | | - authManager.finalizeLogin().then((res) => { |
56 | | - if (!res.isLoggedIn) { |
57 | | - // may cause redirects |
58 | | - authManager.login(); |
59 | | - } |
60 | | - const client = new Azure.ArmStorage.StorageManagementClient(res.creds, subscriptionId); |
61 | | - client.operations.list().then((result) => { |
62 | | - console.log("The result is:"); |
63 | | - console.log(result); |
64 | | - }).catch((err) => { |
65 | | - console.log("An error occurred:"); |
66 | | - console.error(err); |
67 | | - }); |
68 | | - }); |
69 | | - </script> |
70 | | - </head> |
71 | | - <body> |
72 | | - </body> |
73 | | -</html> |
74 | | -``` |
75 | | - |
76 | | -# Related projects |
77 | | - - [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) |
| 1 | +# Azure StorageManagementClient SDK for JavaScript |
| 2 | +This package contains an isomorphic SDK for StorageManagementClient. |
| 3 | + |
| 4 | +## Currently supported environments |
| 5 | +- Node.js version 6.x.x or higher |
| 6 | +- Browser JavaScript |
| 7 | + |
| 8 | +## How to Install |
| 9 | +``` |
| 10 | +npm install @azure/arm-storage |
| 11 | +``` |
| 12 | + |
| 13 | + |
| 14 | +## How to use |
| 15 | + |
| 16 | +### nodejs - Authentication, client creation and list operations as an example written in TypeScript. |
| 17 | + |
| 18 | +```ts |
| 19 | +import * as msRest from "ms-rest-js"; |
| 20 | +import * as msRestAzure from "ms-rest-azure-js"; |
| 21 | +import * as msRestNodeAuth from "ms-rest-nodeauth"; |
| 22 | +import { StorageManagementClient, StorageManagementModels, StorageManagementMappers } from "@azure/arm-storage"; |
| 23 | +const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; |
| 24 | + |
| 25 | +msRestNodeAuth.interactiveLogin().then((creds) => { |
| 26 | + const client = new StorageManagementClient(creds, subscriptionId); |
| 27 | + client.operations.list().then((result) => { |
| 28 | + console.log("The result is:"); |
| 29 | + console.log(result); |
| 30 | + }); |
| 31 | +}).catch((err) => { |
| 32 | + console.error(err); |
| 33 | +}); |
| 34 | +``` |
| 35 | + |
| 36 | +### browser - Authentication, client creation and list operations as an example written in JavaScript. |
| 37 | +See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser. |
| 38 | + |
| 39 | +- index.html |
| 40 | +```html |
| 41 | +<!DOCTYPE html> |
| 42 | +<html lang="en"> |
| 43 | + <head> |
| 44 | + <title>@azure/arm-storage sample</title> |
| 45 | + <script src="node_modules/ms-rest-js/dist/msRest.browser.js"></script> |
| 46 | + <script src="node_modules/ms-rest-azure-js/dist/msRestAzure.js"></script> |
| 47 | + <script src="node_modules/ms-rest-browserauth/dist/msAuth.js"></script> |
| 48 | + <script src="node_modules/@azure/arm-storage/dist/arm-storage.js"></script> |
| 49 | + <script> |
| 50 | + const subscriptionId = "<Subscription_Id>"; |
| 51 | + const authManager = new msAuth.AuthManager({ |
| 52 | + clientId: "<client id for your Azure AD app>", |
| 53 | + tenant: "<optional tenant for your organization>" |
| 54 | + }); |
| 55 | + authManager.finalizeLogin().then((res) => { |
| 56 | + if (!res.isLoggedIn) { |
| 57 | + // may cause redirects |
| 58 | + authManager.login(); |
| 59 | + } |
| 60 | + const client = new Azure.ArmStorage.StorageManagementClient(res.creds, subscriptionId); |
| 61 | + client.operations.list().then((result) => { |
| 62 | + console.log("The result is:"); |
| 63 | + console.log(result); |
| 64 | + }).catch((err) => { |
| 65 | + console.log("An error occurred:"); |
| 66 | + console.error(err); |
| 67 | + }); |
| 68 | + }); |
| 69 | + </script> |
| 70 | + </head> |
| 71 | + <body> |
| 72 | + </body> |
| 73 | +</html> |
| 74 | +``` |
| 75 | + |
| 76 | +# Related projects |
| 77 | + - [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) |
0 commit comments