def create_keyvault(access_token, subscription_id, rgname, vault_name, location,<EOL>template_deployment=True, tenant_id=None, object_id=None):
endpoint = '<STR_LIT>'.join([get_rm_endpoint(),<EOL>'<STR_LIT>', subscription_id,<EOL>'<STR_LIT>', rgname,<EOL>'<STR_LIT>', vault_name,<EOL>'<STR_LIT>', KEYVAULT_API])<EOL>if tenant_id is None:<EOL><INDENT>ret = list_tenants(access_token)<EOL>tenant_id = ret['<STR_LIT:value>'][<NUM_LIT:0>]['<STR_LIT>']<EOL><DEDENT>access_policies = [{'<STR_LIT>': tenant_id, '<STR_LIT>': object_id,<EOL>'<STR_LIT>': {<EOL>'<STR_LIT>': ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT:list>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>'],<EOL>'<STR_LIT>': ['<STR_LIT>', '<STR_LIT:list>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>'],<EOL>'<STR_LIT>': ['<STR_LIT>', '<STR_LIT:list>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>'],<EOL>'<STR_LIT>': ['<STR_LIT>', '<STR_LIT:list>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>']<EOL>}}]<EOL>vault_properties = {'<STR_LIT>': tenant_id, '<STR_LIT>': {'<STR_LIT>': '<STR_LIT:A>', '<STR_LIT:name>': '<STR_LIT>'},<EOL>'<STR_LIT>': template_deployment,<EOL>'<STR_LIT>': access_policies}<EOL>vault_body = {'<STR_LIT:location>': location, '<STR_LIT>': vault_properties}<EOL>body = json.dumps(vault_body)<EOL>return do_put(endpoint, body, access_token)<EOL>
Create a new key vault in the named resource group.

    Args:
        access_token (str): A valid Azure authentication token.
        subscription_id (str): Azure subscription id.
        rgname (str): Azure resource group name.
        vault_name (str): Name of the new key vault.
        location (str): Azure data center location. E.g. westus2.
        template_deployment (boolean): Whether to allow deployment from template.
        tenant_id (str): Optionally specify a tenant ID (otherwise picks first response) from
                         ist_tenants().
        object_id (str): Optionally specify an object ID representing user or principal for the
                         access policy.

    Returns:
        HTTP response. JSON body of key vault properties.