How to use the msrestazure.azure_active_directory.AADTokenCredentials function in msrestazure

To help you get started, we’ve selected a few msrestazure 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 / azure_modules / module_utils / azure_rm_common.py View on Github external
def acquire_token_with_username_password(self, authority, resource, username, password, client_id, tenant):
        authority_uri = authority

        if tenant is not None:
            authority_uri = authority + '/' + tenant

        context = AuthenticationContext(authority_uri)
        token_response = context.acquire_token_with_username_password(resource, username, password, client_id)

        return AADTokenCredentials(token_response)
github Azure / azure-batch-maya / azure_batch_maya / scripts / config.py View on Github external
def _configure_post_auth(self):
        self.mgmtCredentials = AADTokenCredentials(self.mgmt_auth_token, 
            cloud_environment=self.aad_environment_provider.getEnvironmentForId(self.aad_environment_id),
            tenant=self.aad_tenant_name)
        self.batchCredentials = AADTokenCredentials(self.batch_auth_token, 
            cloud_environment=self.aad_environment_provider.getEnvironmentForId(self.aad_environment_id),
            tenant=self.aad_tenant_name)

        if self.can_init_from_config:
            self.init_from_config()
            self.ui.init_from_config()

        else:
            self.subscription_client = SubscriptionClient(self.mgmtCredentials, 
                base_url=self.aad_environment_provider.getResourceManager(self.aad_environment_id))
            self.ui.init_post_auth()
github ansible / awx / awx / plugins / inventory / azure_rm.py View on Github external
def acquire_token_with_username_password(self, authority, resource, username, password, client_id, tenant):
        authority_uri = authority

        if tenant is not None:
            authority_uri = authority + '/' + tenant

        context = AuthenticationContext(authority_uri)
        token_response = context.acquire_token_with_username_password(resource, username, password, client_id)
        return AADTokenCredentials(token_response)
github ansible / ansible / contrib / vault / azure_vault.py View on Github external
def acquire_token_with_username_password(self, authority, resource, username, password, client_id, tenant):
        authority_uri = authority

        if tenant is not None:
            authority_uri = authority + '/' + tenant

        context = AuthenticationContext(authority_uri)
        token_response = context.acquire_token_with_username_password(resource, username, password, client_id)
        return AADTokenCredentials(token_response)
github Azure / azure-batch-maya / azure_batch_maya / scripts / tools / job_watcher.py View on Github external
def update_batch_and_storage_client_creds(batch_auth_token, mgmt_auth_token, environment_provider, aad_environment_id):
    global batch_client
    batchCredentials = AADTokenCredentials(batch_auth_token,
        cloud_environment= environment_provider.getEnvironmentForId(aad_environment_id),
        tenant=aadTenant)
    mgmtCredentials = AADTokenCredentials(mgmt_auth_token,
        cloud_environment= environment_provider.getEnvironmentForId(aad_environment_id),
        tenant=aadTenant)

    batch_client._client._mgmt_credentials = mgmtCredentials
    batch_client._client.creds = batchCredentials
github Azure / azure_preview_modules / module_utils / azure_rm_common.py View on Github external
def acquire_token_with_username_password(self, authority, resource, username, password, client_id, tenant):
        authority_uri = authority

        if tenant is not None:
            authority_uri = authority + '/' + tenant

        context = AuthenticationContext(authority_uri)
        token_response = context.acquire_token_with_username_password(resource, username, password, client_id)

        return AADTokenCredentials(token_response)
github ansible / ansible / contrib / inventory / azure_rm.py View on Github external
def acquire_token_with_username_password(self, authority, resource, username, password, client_id, tenant):
        authority_uri = authority

        if tenant is not None:
            authority_uri = authority + '/' + tenant

        context = AuthenticationContext(authority_uri)
        token_response = context.acquire_token_with_username_password(resource, username, password, client_id)
        return AADTokenCredentials(token_response)
github ansible / ansible / lib / ansible / module_utils / azure_rm_common.py View on Github external
def acquire_token_with_username_password(self, authority, resource, username, password, client_id, tenant):
        authority_uri = authority

        if tenant is not None:
            authority_uri = authority + '/' + tenant

        context = AuthenticationContext(authority_uri)
        token_response = context.acquire_token_with_username_password(resource, username, password, client_id)

        return AADTokenCredentials(token_response)
github hortonworks / ansible-hortonworks / inventory / azure / azure_rm.py View on Github external
def acquire_token_with_username_password(self, authority, resource, username, password, client_id, tenant):
        authority_uri = authority

        if tenant is not None:
            authority_uri = authority + '/' + tenant

        context = AuthenticationContext(authority_uri)
        token_response = context.acquire_token_with_username_password(resource, username, password, client_id)
        return AADTokenCredentials(token_response)