How to use the ms-rest-azure.AzureEnvironment function in ms-rest-azure

To help you get started, we’ve selected a few ms-rest-azure examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Azure / meta-azure-service-broker / test / unit / common / utils-tests.js View on Github external
var log = require('winston').loggers.get('common');

var should = require('should');
var sinon = require('sinon');
var util = require('util');
var AzureEnvironment = require('ms-rest-azure').AzureEnvironment;
var request = require('request');
var underscore = require('underscore');

var Common = require('../../../lib/common');
var Token = require('../../../lib/common/token');

describe('Util', function () {

  describe('config', function () {
    context('when configurations are set via environment variables', function () {
      var keys = [
        'ENVIRONMENT',
        'SUBSCRIPTION_ID',
        'TENANT_ID',
        'CLIENT_ID',
        'CLIENT_SECRET',
github Azure / azure-sdk-for-node / test / framework / suite-base.js View on Github external
_createUserCredentials: function() {
    if(process.env['AZURE_ENVIRONMENT'] && process.env['AZURE_ENVIRONMENT'].toUpperCase() === 'DOGFOOD') {
      var df = {
        name: 'Dogfood',
        portalUrl: 'https://windows.azure-test.net/',
        activeDirectoryEndpointUrl: 'https://login.windows-ppe.net/',
        activeDirectoryResourceId: 'https://management.core.windows.net/',
        managementEndpointUrl: 'https://management-preview.core.windows-int.net/',
        resourceManagerEndpointUrl: 'https://api-dogfood.resources.windows-int.net/'
      };
      var env = msRestAzure.AzureEnvironment.add(df);
      return new msRestAzure.UserTokenCredentials(this.clientId, this.domain, this.username,
        this.password, { 'tokenCache': this.tokenCache, 'environment': env });
    }
    
    return new msRestAzure.UserTokenCredentials(this.clientId, this.domain, this.username,
      this.password, { 'tokenCache': this.tokenCache });
  },
github Azure / meta-azure-service-broker / lib / common / index.js View on Github external
}

  var winstonConfig = require('../../winston.json');
  winstonConfig['console']['label'] = moduleName;
  return winston.loggers.add(moduleName, winstonConfig);
}
module.exports.getLogger = getLogger;

var log = getLogger(LOG_CONSTANTS.COMMON);

var _ = require('underscore');
var uuid = require('uuid');
var uuidv5 = require('uuid/v5');
var util = require('util');
var HttpStatus = require('http-status-codes');
var AzureEnvironment = require('ms-rest-azure').AzureEnvironment;
var deepExtend = require('deep-extend');

var validateConfigurations = function() {
  var requiredEnvNames = [
    'ENVIRONMENT', 'SUBSCRIPTION_ID', 'TENANT_ID', 'CLIENT_ID', 'CLIENT_SECRET',
    'SECURITY_USER_NAME', 'SECURITY_USER_PASSWORD',
    'AZURE_BROKER_DATABASE_PROVIDER', 'AZURE_BROKER_DATABASE_SERVER', 'AZURE_BROKER_DATABASE_USER', 'AZURE_BROKER_DATABASE_PASSWORD', 'AZURE_BROKER_DATABASE_NAME', 'AZURE_BROKER_DATABASE_ENCRYPTION_KEY'
  ];

  var missingParams = [];
  requiredEnvNames.forEach(function(requiredEnvName) {
    var value = process.env[requiredEnvName];
    if (_.isUndefined(value) || _.isEmpty(value)) {
      missingParams.push(requiredEnvName);
    }
  });
github microsoft / botbuilder-js / tools / framework / suite-base.js View on Github external
_createApplicationCredentials: function() {
        if(process.env['AZURE_ENVIRONMENT'] && process.env['AZURE_ENVIRONMENT'].toUpperCase() === 'DOGFOOD') {
            var df = {
                name: 'Dogfood',
                portalUrl: 'https://windows.azure-test.net/',
                activeDirectoryEndpointUrl: 'https://login.windows-ppe.net/',
                activeDirectoryResourceId: 'https://management.core.windows.net/',
                managementEndpointUrl: 'https://management-preview.core.windows-int.net/',
                resourceManagerEndpointUrl: 'https://api-dogfood.resources.windows-int.net/'
            };
            var env = msRestAzure.AzureEnvironment.add(df);               
            return new msRestAzure.ApplicationTokenCredentials(this.clientId, this.domain, this.secret, {
                'tokenCache': this.tokenCache,
                'environment': env
            });
        }
    
        return new msRestAzure.ApplicationTokenCredentials(this.clientId, this.domain, this.secret, {
            'tokenCache': this.tokenCache
        });
    },
github Azure / azure-sdk-for-node / lib / azure.js View on Github external
*
 * @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.
 *
 * @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.
 *
 */
exports.createAnalysisServicesManagementClient = function (credentials, subscriptionId, options) {
  return new AzureARMAnalysisServices.AnalysisServicesManagementClient(credentials, subscriptionId, null, options);
};

var msRestAzure = require('ms-rest-azure');

exports.interactiveLogin = msRestAzure.interactiveLogin;
exports.loginWithServicePrincipalSecret = msRestAzure.loginWithServicePrincipalSecret;
exports.loginWithUsernamePassword = msRestAzure.loginWithUsernamePassword;
exports.AzureEnvironment = msRestAzure.AzureEnvironment;
exports.ApplicationTokenCredentials = msRestAzure.ApplicationTokenCredentials;
exports.DeviceTokenCredentials = msRestAzure.DeviceTokenCredentials;
exports.UserTokenCredentials = msRestAzure.UserTokenCredentials;
exports.BaseResource = msRestAzure.BaseResource;
exports.GenericAzureServiceClient = msRestAzure.AzureServiceClient;

var msRest = require('ms-rest');
exports.RequestObject = msRest.WebResource;