Esempio n. 1
0
def create_account(client,
                   resource_group_name, account_name, location, tags=None, storage_account=None,
                   keyvault=None, keyvault_url=None, no_wait=False, public_network_access=None,
                   encryption_key_source=None, encryption_key_identifier=None, identity_type=None):
    properties = AutoStorageBaseProperties(storage_account_id=storage_account) \
        if storage_account else None
    identity = BatchAccountIdentity(type=identity_type) if identity_type else None
    if (encryption_key_source and
            encryption_key_source.tolower() == "microsoft.keyvault" and not encryption_key_identifier):
        raise ValueError("The --encryption-key-identifier property is required when "
                         "--encryption-key-source is set to Microsoft.KeyVault")
    encryption_key_identifier = KeyVaultProperties(key_identifier=encryption_key_identifier) \
        if encryption_key_identifier else None
    encryption = EncryptionProperties(
        key_source=encryption_key_source,
        encryption_key_identifier=encryption_key_identifier) if encryption_key_source else None
    parameters = BatchAccountCreateParameters(location=location,
                                              tags=tags,
                                              auto_storage=properties,
                                              public_network_access=public_network_access,
                                              encryption=encryption,
                                              identity=identity)
    if keyvault:
        parameters.key_vault_reference = {'id': keyvault, 'url': keyvault_url}
        parameters.pool_allocation_mode = 'UserSubscription'

    return sdk_no_wait(no_wait, client.create, resource_group_name=resource_group_name,
                       account_name=account_name, parameters=parameters)
Esempio n. 2
0
def create_account(client,
                   resource_group_name, account_name, location, tags=None, storage_account=None,
                   keyvault=None, keyvault_url=None, no_wait=False):
    properties = AutoStorageBaseProperties(storage_account_id=storage_account) \
        if storage_account else None
    parameters = BatchAccountCreateParameters(location=location,
                                              tags=tags,
                                              auto_storage=properties)
    if keyvault:
        parameters.key_vault_reference = {'id': keyvault, 'url': keyvault_url}
        parameters.pool_allocation_mode = 'UserSubscription'

    return sdk_no_wait(no_wait, client.create, resource_group_name=resource_group_name,
                       account_name=account_name, parameters=parameters)
def create_account(client, resource_group_name, account_name, location,  # pylint:disable=too-many-arguments
                   tags=None, storage_account=None, keyvault=None, keyvault_url=None):
    properties = AutoStorageBaseProperties(storage_account_id=storage_account) \
        if storage_account else None
    parameters = BatchAccountCreateParameters(location=location,
                                              tags=tags,
                                              auto_storage=properties)
    if keyvault:
        parameters.key_vault_reference = {'id': keyvault, 'url': keyvault_url}
        parameters.pool_allocation_mode = 'UserSubscription'

    return client.create(resource_group_name=resource_group_name,
                         account_name=account_name,
                         parameters=parameters)
Esempio n. 4
0
def create_account(client,  # pylint:disable=too-many-arguments
                   resource_group_name, account_name, location, tags=None, storage_account=None,
                   keyvault=None, keyvault_url=None):
    properties = AutoStorageBaseProperties(storage_account_id=storage_account) \
        if storage_account else None
    parameters = BatchAccountCreateParameters(location=location,
                                              tags=tags,
                                              auto_storage=properties)
    if keyvault:
        parameters.key_vault_reference = {'id': keyvault, 'url': keyvault_url}
        parameters.pool_allocation_mode = 'UserSubscription'

    return client.create(resource_group_name=resource_group_name,
                         account_name=account_name,
                         parameters=parameters)