from pprint import pprint
from configparser import ConfigParser

from azure.common.credentials import ServicePrincipalCredentials

# Initialize the Parser.
config = ConfigParser()

# Read the file.
try:
    config.read('config/config.ini')
except:
    config.read('configs/config.ini')

# Grab the Azure Credentials needed.
tenant_id = config.get('azure_credentials', 'azure_tenant_id')
client_id = config.get('azure_credentials', 'azure_client_id')
client_secret = config.get('azure_credentials', 'azure_client_secret')

# Define the Credentials.
credential = ServicePrincipalCredentials(
    tenant=tenant_id,
    client_id=client_id,
    secret=client_secret
)

# You can grab the Token.
pprint(credential.token)

# Construct Auth.
pprint(credential.construct_auth())

# Grab the Headers.
pprint(credential.header)

# Grab the Store Key.
pprint(credential.store_key)

# Grab the Client Secret.
pprint(credential.secret)

# Grab the Header Scheme.
pprint(credential.scheme)

# You can refresh a Session.
credential.refresh_session()

# You can Sign a Session.
credential.signed_session()

from pprint import pprint
from configparser import ConfigParser

from azure.common.credentials import ServicePrincipalCredentials

# Initialize the Parser.
config = ConfigParser()

# Read the file.
try:
    config.read('config/config.ini')
except:
    config.read('configs/config.ini')

# Grab the Azure Credentials needed.
tenant_id = config.get('azure_credentials', 'azure_tenant_id')
client_id = config.get('azure_credentials', 'azure_client_id')
client_secret = config.get('azure_credentials', 'azure_client_secret')

# Define the Credentials.
credential = ServicePrincipalCredentials(
    tenant=tenant_id,
    client_id=client_id,
    secret=client_secret
)

# You can grab the Token.
pprint(credential.token)

# Construct Auth.
pprint(credential.construct_auth())

# Grab the Headers.
pprint(credential.header)

# Grab the Store Key.
pprint(credential.store_key)

# Grab the Client Secret.
pprint(credential.secret)

# Grab the Header Scheme.
pprint(credential.scheme)

# You can refresh a Session.
credential.refresh_session()

# You can Sign a Session.
credential.signed_session()

# Initialize the Parser. # Read the file. # Grab the Azure Credentials needed. # Define the Credentials. # You can grab the Token. # Construct Auth. # Grab the Headers. # Grab the Store Key. # Grab the Client Secret. # Grab the Header Scheme. # You can refresh a Session. # You can Sign a Session.