Skip to content

Commit

Permalink
updates to readme (#1071)
Browse files Browse the repository at this point in the history
  • Loading branch information
amarzavery committed May 23, 2016
1 parent f9a1606 commit f1f7584
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions ClientRuntimes/NodeJS/ms-rest-azure/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ the user will get a DeviceTokenCredentials object.
```javascript
var someAzureServiceClient = require('azure-arm-someService');
msRestAzure.interactiveLogin(function(err, credentials) {
if (err) return console.log(err);
var client = new someAzureServiceClient(credentials, 'your-subscriptionId');
client.someOperationGroup.method(param1, param2, function(err, result) {
if (err) console.log(err);
console.log(result);
if (err) return console.log(err);
return console.log(result);
});
});
```
Expand All @@ -37,29 +38,31 @@ 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) {
if (err) return console.log(err);
var client = new someAzureServiceClient(credentials, 'your-subscriptionId');
client.someOperationGroup.method(param1, param2, function(err, result) {
if (err) console.log(err);
console.log(result);
if (err) return console.log(err);
return console.log(result);
});
});
```

### Non-Interactive Authentication
If you need to create an automation account for non interactive or scripting scenarios then please take a look at the documentation over [here](https://github.com/Azure/azure-sdk-for-node/blob/master/Documentation/Authentication.md). Once you have created a service principal you can authenticate using the following code snippet.

#### Login with service principal name and secret
```javascript
var someAzureServiceClient = require('azure-arm-someService');
msRestAzure.loginWithServicePrincipalSecret(clientId, secret, domain, function(err, credentials) {
if (err) return console.log(err);
var client = new someAzureServiceClient(credentials, 'your-subscriptionId');
client.someOperationGroup.method(param1, param2, function(err, result) {
if (err) console.log(err);
console.log(result);
if (err) retutrn console.log(err);
return console.log(result);
});
});
```

### Non-Interactive Authentication
If you need to create an automation account for non interactive or scripting scenarios then please take a look at the documentation over [here](https://github.com/Azure/azure-sdk-for-node/blob/master/Documentation/Authentication.md).

## Related Projects

- [AutoRest](https://github.com/Azure/AutoRest)
- [AutoRest](https://github.com/Azure/AutoRest)

0 comments on commit f1f7584

Please sign in to comment.