Example #1
0
 def __init__(self, cli_ctx):
     profile = Profile(cli_ctx=cli_ctx)
     credentials, _, tenant_id = profile.get_login_credentials(
         resource=cli_ctx.cloud.endpoints.active_directory_graph_resource_id)
     self.client = GraphRbacManagementClient(
         credentials, tenant_id, base_url=cli_ctx.cloud.endpoints.active_directory_graph_resource_id)
     configure_common_settings(cli_ctx, self.client)
Example #2
0
def _graph_client_factory(**_):
    from azure.cli.core._profile import Profile
    profile = Profile()
    cred, _, tenant_id = profile.get_login_credentials(True)
    client = GraphRbacManagementClient(cred, tenant_id)
    configure_common_settings(client)
    return client
Example #3
0
def _graph_client_factory(**_):
    from azure.cli.core._profile import Profile
    profile = Profile()
    cred, _, tenant_id = profile.get_login_credentials(True)
    client = GraphRbacManagementClient(cred, tenant_id)
    configure_common_settings(client)
    return client
Example #4
0
def cf_sf_client(_):
    from azure.cli.core.util import CLIError
    from azure.servicefabric import ServiceFabricClientAPIs
    from azure.cli.command_modules.sf.custom import (
        sf_get_cert_info, sf_get_connection_endpoint, sf_get_ca_cert_info,
        sf_get_verify_setting)
    from azure.cli.command_modules.sf.cluster_auth import (
        ClientCertAuthentication)
    from azure.cli.core.commands.client_factory import (
        configure_common_settings)

    endpoint = sf_get_connection_endpoint()
    if endpoint is None:
        raise CLIError("Connection endpoint not specified, run 'az sf cluster "
                       "select' first.")

    cert = sf_get_cert_info()
    if cert is not None:
        ca_cert = sf_get_ca_cert_info()
    else:
        ca_cert = None

    no_verify = sf_get_verify_setting()

    auth = ClientCertAuthentication(cert, ca_cert, no_verify)
    client = ServiceFabricClientAPIs(auth, base_url=endpoint)
    configure_common_settings(client)
    return client
Example #5
0
def _graph_client_factory(**_):
    from azure.cli.core._profile import Profile
    profile = Profile()
    cred, _, tenant_id = profile.get_login_credentials(
        resource=get_env()[ENDPOINT_URLS.ACTIVE_DIRECTORY_GRAPH_RESOURCE_ID])
    client = GraphRbacManagementClient(cred, tenant_id)
    configure_common_settings(client)
    return client
def _graph_client_factory(cli_ctx, **_):
    profile = Profile(cli_ctx=cli_ctx)
    cred, _, tenant_id = profile.get_login_credentials(
        resource=cli_ctx.cloud.endpoints.active_directory_graph_resource_id)
    client = GraphRbacManagementClient(
        cred,
        tenant_id,
        base_url=cli_ctx.cloud.endpoints.active_directory_graph_resource_id)
    configure_common_settings(cli_ctx, client)
    return client
Example #7
0
def _graph_client_factory(cli_ctx, **_):
    from azure.cli.core._profile import Profile
    from azure.cli.core.commands.client_factory import configure_common_settings
    from azure.graphrbac import GraphRbacManagementClient
    profile = Profile(cli_ctx=cli_ctx)
    cred, _, tenant_id = profile.get_login_credentials(
        resource=cli_ctx.cloud.endpoints.active_directory_graph_resource_id)
    client = GraphRbacManagementClient(cred, tenant_id,
                                       base_url=cli_ctx.cloud.endpoints.active_directory_graph_resource_id)
    configure_common_settings(cli_ctx, client)
    return client
Example #8
0
def _graph_client_factory(**_):
    from azure.cli.core._profile import Profile, CLOUD
    profile = Profile()
    cred, _, tenant_id = profile.get_login_credentials(
        resource=CLOUD.endpoints.active_directory_graph_resource_id)
    client = GraphRbacManagementClient(
        cred,
        tenant_id,
        base_url=CLOUD.endpoints.active_directory_graph_resource_id)
    configure_common_settings(client)
    return client
Example #9
0
def get_graph_rbac_management_client(cli_ctx, **_):
    from azure.cli.core._profile import Profile
    from azure.graphrbac import GraphRbacManagementClient

    profile = Profile(cli_ctx=cli_ctx)
    cred, _, tenant_id = profile.get_login_credentials(
        resource=cli_ctx.cloud.endpoints.active_directory_graph_resource_id)
    client = GraphRbacManagementClient(
        cred, tenant_id,
        base_url=cli_ctx.cloud.endpoints.active_directory_graph_resource_id)
    configure_common_settings(cli_ctx, client)
    return client
Example #10
0
def get_acr_service_client():
    '''Returns the client for managing container registries.
    '''
    profile = Profile()
    credentials, subscription_id, _ = profile.get_login_credentials()

    config = ContainerRegistryConfiguration(subscription_id,
                                            get_acr_api_version(), credentials)
    client = ContainerRegistry(config)

    configure_common_settings(client)

    return client
Example #11
0
def cf_sf_client(_):
    sf_config = SfConfigParser()
    endpoint = sf_config.connection_endpoint()
    if not endpoint:
        raise CLIError("Connection endpoint not specified, run 'az sf cluster select' first.")

    cert = sf_config.cert_info()
    ca_cert = sf_config.ca_cert_info()
    no_verify = sf_config.no_verify_setting()

    auth = ClientCertAuthentication(cert, ca_cert, no_verify)
    client = ServiceFabricClientAPIs(auth, base_url=endpoint)
    configure_common_settings(client)
    return client
Example #12
0
def cf_sf_client(_):
    sf_config = SfConfigParser()
    endpoint = sf_config.connection_endpoint()
    if not endpoint:
        raise CLIError(
            "Connection endpoint not specified, run 'az sf cluster select' first."
        )

    cert = sf_config.cert_info()
    ca_cert = sf_config.ca_cert_info()
    no_verify = sf_config.no_verify_setting()

    auth = ClientCertAuthentication(cert, ca_cert, no_verify)
    client = ServiceFabricClientAPIs(auth, base_url=endpoint)
    configure_common_settings(client)
    return client
Example #13
0
def get_acr_service_client():
    '''Returns the client for managing container registries.
    '''
    profile = Profile()
    credentials, subscription_id, _ = profile.get_login_credentials()

    config = ContainerRegistryManagementClientConfiguration(
        credentials,
        subscription_id,
        api_version=get_acr_api_version(),
        base_url=CLOUD.endpoints.resource_manager)
    client = ContainerRegistryManagementClient(config)

    configure_common_settings(client)

    return client