Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

Commit

Permalink
Updated readme and runtime dependency to 1.14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
amarzavery committed May 21, 2016
1 parent f2e167a commit d14ecc1
Show file tree
Hide file tree
Showing 64 changed files with 359 additions and 552 deletions.
42 changes: 29 additions & 13 deletions Documentation/Authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ info: Executing command login
info: login command OK
```

## Using serviceprincipal authentication in your node.js script
## Using authentication in your node.js script
- Service Principal Authentication
```javascript
var msrestAzure = require('ms-rest-azure');
//service principal authentication
Expand All @@ -112,15 +113,30 @@ info: login command OK
var credentials = new msRestAzure.ApplicationTokenCredentials('your-client-id', 'your-domain', 'your-secret');
```

## Using user authentitcation in your node.js script
Currently, the node sdk only supports users with org-id (organizational account) and have 2FA disabled.
```javascript
var msrestAzure = require('ms-rest-azure');
//user authentication
'your-client-id' - is the id provided by Azure Active Directory for your application
'your-domain' - is the tenant id (a guid) or the part **after @** in your username (user1@**contosocorp.com**) ('contosocorp.com')
'your-username' - is your username ('user1@contosocorp.com')
'your-password' - password associated with the username
'your-redirect-uri' - is the redirect uri for your application. Providing 'http://localhost:8080' should also be fine.
var credentials = new msRestAzure.UserTokenCredentials('your-client-id', 'your-domain', 'your-username', 'your-password', 'your-redirect-uri');
```
- Interactive Login is the simplest and the best way to authenticate.
It provides a url and code that needs to be copied and pasted in a browser and authenticated over there. If successful,
the user will get a DeviceTokenCredentials object.
```javascript
var someAzureServiceClient = require('azure-arm-someService');
msRestAzure.interactiveLogin(function(err, credentials) {
var client = new someAzureServiceClient(credentials, 'your-subscriptionId');
client.someOperationGroup.method(param1, param2, function(err, result) {
if (err) console.log(err);
console.log(result);
});
});
```

- Login with username and password
This mechanism will only work for organizational ids and ids that are not 2FA enabled.
Otherwise it is better to use the above mechanism (interactive login).
```javascript
var someAzureServiceClient = require('azure-arm-someService');
msRestAzure.loginWithUsernamePassword(username, password, function(err, credentials) {
var client = new someAzureServiceClient(credentials, 'your-subscriptionId');
client.someOperationGroup.method(param1, param2, function(err, result) {
if (err) console.log(err);
console.log(result);
});
});
```
3 changes: 0 additions & 3 deletions lib/services/HDInsight2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
"azure"
],
"main": "./lib/hdinsight2.js",
"engines": {
"node": ">= 0.6.15"
},
"licenses": [
{
"type": "Apache 2.0",
Expand Down
3 changes: 0 additions & 3 deletions lib/services/HDInsightJob2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
"azure"
],
"main": "./lib/hdinsightjob2.js",
"engines": {
"node": ">= 0.6.15"
},
"licenses": [
{
"type": "Apache 2.0",
Expand Down
3 changes: 0 additions & 3 deletions lib/services/apiAppManagement/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
"apiapp"
],
"main": "./lib/apiApp.js",
"engines": {
"node": ">= 0.6.15"
},
"licenses": [
{
"type": "Apache 2.0",
Expand Down
33 changes: 18 additions & 15 deletions lib/services/authorizationManagement/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Microsoft Azure SDK for Node.js - Authorization

This project provides a Node.js package for accessing the Azure PAS. Right now it supports:
- **Node.js version: 0.10.0 or higher**
- **Node.js version: 4.x.x or higher**
- **API version: **

## Features
Expand All @@ -15,20 +15,23 @@ npm install azure-arm-authorization

## How to Use

### Authentication

### Create the Authorization client

```javascript
var fs = require("fs"),
common = require("azure-common"),
authorizationManagement = require("azure-arm-authorization");

var authorizationManagementClient = authorizationManagement.createAuthorizationManagementClient(new common.TokenCloudCredentials({
subscriptionId: "<your subscription id>",
token: "<your token here>"
}));
```
### Authentication, client creation and listing role assignments as an example

```javascript
var msrestAzure = require('ms-rest-azure');
var authorizationManagement = require("azure-arm-authorization");

// Interactive Login
// It provides a url and code that needs to be copied and pasted in a browser and authenticated over there. If successful,
// the user will get a DeviceTokenCredentials object.
msRestAzure.interactiveLogin(function(err, credentials) {
var client = new authorizationManagement(credentials, 'your-subscription-id');
client.roleAssignments.listForResourceGroup(rgName, function(err, result) {
if (err) console.log(err);
console.log(result);
});
});
```

## Related projects

Expand Down
7 changes: 2 additions & 5 deletions lib/services/authorizationManagement/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,15 @@
"azure"
],
"main": "./lib/authorization.js",
"engines": {
"node": ">= 0.10.0"
},
"licenses": [
{
"type": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0"
}
],
"dependencies": {
"ms-rest-azure": "^1.10.0",
"ms-rest": "^1.10.0"
"ms-rest-azure": "^1.14.0",
"ms-rest": "^1.14.0"
},
"homepage": "http://github.com/Azure/azure-sdk-for-node",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion lib/services/batch/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Microsoft Azure SDK for Node.js - Batch Service

This project provides a Node.js package that makes it easy to work with Microsoft Azure Batch Service. Right now it supports:
- **Node.js version: 0.10.0 or higher**
- **Node.js version: 4.x.x or higher**

## How to Install

Expand Down
7 changes: 2 additions & 5 deletions lib/services/batch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,15 @@
"azure"
],
"main": "./lib/batch.js",
"engines": {
"node": ">= 0.10.0"
},
"licenses": [
{
"type": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0"
}
],
"dependencies": {
"ms-rest": "^1.12.0",
"ms-rest-azure": "^1.12.0",
"ms-rest": "^1.14.0",
"ms-rest-azure": "^1.14.0",
"underscore": "^1.4.0",
"moment": "^2.12.0"
},
Expand Down
41 changes: 16 additions & 25 deletions lib/services/batchManagement/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Microsoft Azure SDK for Node.js - Batch Management

This project provides a Node.js package that makes it easy to manage Microsoft Azure Batch Resources. Right now it supports:
- **Node.js version: 0.10.0 or higher**
- **Node.js version: 4.x.x or higher**

## How to Install

Expand All @@ -11,33 +11,24 @@ npm install azure-arm-batch

## How to use

### Authentication
### Authentication, client creation and listing accounts as an example

```javascript
var msrestAzure = require('ms-rest-azure');
//user authentication
var credentials = new msRestAzure.UserTokenCredentials('your-client-id', 'your-domain', 'your-username', 'your-password', 'your-redirect-uri');
//service principal authentication
var credentials = new msRestAzure.ApplicationTokenCredentials('your-client-id', 'your-domain', 'your-secret');
var batchManagementClient = require('azure-arm-batch');

// Interactive Login
// It provides a url and code that needs to be copied and pasted in a browser and authenticated over there. If successful,
// the user will get a DeviceTokenCredentials object.
msRestAzure.interactiveLogin(function(err, credentials) {
var client = new batchManagementClient(credentials, 'your-subscription-id');
client.account.list(rgName, function(err, result, request, response) {
if (err) console.log(err);
console.log(result);
});
});
```

### Create the BatchManagementClient

```javascript
var batchManagementClient = require('azure-arm-batch');
var client = new batchManagementClient(credentials, 'your-subscription-id');
```

## List Accounts

```javascript
client.account.list('resourceGrp', function (err, result, request, response) {
should.not.exist(err);
should.exist(result);
result.length.should.be.above(0);
response.statusCode.should.equal(200);
done();
});
});
```
## Related projects

- [Microsoft Azure SDK for Node.js](https://github.com/Azure/azure-sdk-for-node)
7 changes: 2 additions & 5 deletions lib/services/batchManagement/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,15 @@
"azure"
],
"main": "./lib/batchManagementClient.js",
"engines": {
"node": ">= 0.10.0"
},
"licenses": [
{
"type": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0"
}
],
"dependencies": {
"ms-rest": "^1.12.0",
"ms-rest-azure": "^1.12.0"
"ms-rest": "^1.14.0",
"ms-rest-azure": "^1.14.0"
},
"homepage": "http://github.com/Azure/azure-sdk-for-node",
"repository": {
Expand Down
63 changes: 17 additions & 46 deletions lib/services/cdnManagement/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Microsoft Azure SDK for Node.js - Cdn

This project provides a Node.js package for accessing the Azure Cdn Client. Right now it supports:
- **Node.js version: 0.10.0 or higher**
- **Node.js version: 4.x.x or higher**
- **API version: **

## Features
Expand All @@ -13,31 +13,30 @@ This project provides a Node.js package for accessing the Azure Cdn Client. Righ

## Install from npm

We provide both fine-grained modules for different Microsoft Azure services which you can install separately, and an all-up module which contains everything.

**Notice**: we haven't provided fine-grained modules for every supported Microsoft Azure services yet. This will come soon.

### Install the all-up module

```
npm install azure
npm install azure-arm-cdn
```
&nbsp;

## How to Use

### Initialise the client
```javascript
var msrestAzure = require('ms-rest-azure');
var ManagementClient = require('../../../lib/services/cdnManagement/lib/cdnManagementClient');
### Authentication, client creation and listing profiles as an example

//user authentication
var credentials = new msRestAzure.UserTokenCredentials('your-client-id', 'your-domain', 'your-username', 'your-password', 'your-redirect-uri');
//service principal authentication
var credentials = new msRestAzure.ApplicationTokenCredentials('your-client-id', 'your-domain', 'your-secret');
```javascript
var msrestAzure = require('ms-rest-azure');
var CDNManagementClient = require('azure-arm-cdn');

var client = new ManagementClient(credentials, 'your-subscription-id');
```
// Interactive Login
// It provides a url and code that needs to be copied and pasted in a browser and authenticated over there. If successful,
// the user will get a DeviceTokenCredentials object.
msRestAzure.interactiveLogin(function(err, credentials) {
var client = new CDNManagementClient(credentials, 'your-subscription-id');
client.profiles.listBySubscriptionId(function(err, result, request, response) {
if (err) console.log(err);
console.log(result);
});
});
```

### Profile operations
```javascript
Expand Down Expand Up @@ -335,35 +334,7 @@ client.operations.list(function(err, result, request, response) {
});
```

## Need Help?
* [Read the docs](http://azure.github.io/azure-sdk-for-node)
* [Open an issue in GitHub](http://github.com/azure/azure-sdk-for-node)
* [Microsoft Azure Forums on MSDN and Stack Overflow](http://go.microsoft.com/fwlink/?LinkId=234489)
## Related Projects

- [Microsoft Azure SDK for Node.js](https://github.com/Azure/azure-sdk-for-node)
- [AutoRest](https://github.com/Azure/autorest)
## Contribute
* If you would like to become an active contributor to this project please follow the instructions provided in [Microsoft Azure Projects Contribution Guidelines](http://azure.github.com/guidelines.html).
### Getting Started Developing
Want to get started hacking on the code, super! Follow the following instructions to get up and running. These
instructions expect you have Git and a supported version of Node installed.
1. Fork it
2. Git Clone your fork (`git clone {your repo}`)
3. Move into sdk directory (`cd azure-sdk-for-node`)
4. Install all dependencies (`npm install`)
5. Run the tests (`npm test`). You should see all tests passing.
### Contributing Code to the Project
You found something you'd like to change, great! Please submit a pull request and we'll do our best to work with you to
get your code included into the project.
1. Commit your changes (`git commit -am 'Add some feature'`)
2. Push to the branch (`git push origin my-new-feature`)
3. Create new Pull Request
7 changes: 2 additions & 5 deletions lib/services/cdnManagement/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,15 @@
"azure"
],
"main": "./lib/cdnManagementClient.js",
"engines": {
"node": ">= 0.10.0"
},
"licenses": [
{
"type": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0"
}
],
"dependencies": {
"ms-rest": "^1.13.1",
"ms-rest-azure": "^1.13.1"
"ms-rest": "^1.14.0",
"ms-rest-azure": "^1.14.0"
},
"homepage": "http://github.com/Azure/azure-sdk-for-node",
"repository": {
Expand Down
3 changes: 0 additions & 3 deletions lib/services/commerce/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
"azure"
],
"main": "./lib/commerce.js",
"engines": {
"node": ">= 0.6.15"
},
"licenses": [
{
"type": "Apache 2.0",
Expand Down
3 changes: 0 additions & 3 deletions lib/services/computeManagement/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
"azure"
],
"main": "./lib/compute.js",
"engines": {
"node": ">= 0.6.15"
},
"licenses": [
{
"type": "Apache 2.0",
Expand Down
Loading

0 comments on commit d14ecc1

Please sign in to comment.