def create_blob_sas_defintion(self, storage_account_name, vault_url):
from azure.storage.blob import BlockBlobService, ContainerPermissions<EOL>from azure.keyvault.models import SasTokenType, SasDefinitionAttributes<EOL>from azure.keyvault import SecretId<EOL>service = BlockBlobService(account_name=storage_account_name,<EOL>account_key='<STR_LIT>')<EOL>permissions = ContainerPermissions(read=True, write=True, delete=True, list=True)<EOL>temp_token = service.generate_container_shared_access_signature(container_name='<STR_LIT>',<EOL>permission=permissions,<EOL>expiry='<STR_LIT>')<EOL>blob_sas_template_uri = service.make_container_url(container_name='<STR_LIT>',<EOL>protocol='<STR_LIT>',<EOL>sas_token=temp_token)<EOL>attributes = SasDefinitionAttributes(enabled=True)<EOL>blob_sas_def = self.client.set_sas_definition(vault_base_url=vault_url,<EOL>storage_account_name=storage_account_name,<EOL>sas_definition_name='<STR_LIT>',<EOL>template_uri=blob_sas_template_uri,<EOL>sas_type=SasTokenType.service,<EOL>validity_period='<STR_LIT>',<EOL>sas_definition_attributes=attributes)<EOL>sas_secret_id = SecretId(uri=blob_sas_def.secret_id)<EOL>blob_sas_token = self.client.get_secret(vault_base_url=sas_secret_id.vault,<EOL>secret_name=sas_secret_id.name,<EOL>secret_version=sas_secret_id.version).value<EOL>service = BlockBlobService(account_name=storage_account_name,<EOL>sas_token=blob_sas_token)<EOL>service.create_blob_from_text(container_name='<STR_LIT>',<EOL>blob_name='<STR_LIT>',<EOL>text=u'<STR_LIT>')<EOL>blobs = list(service.list_blobs(container_name='<STR_LIT>'))<EOL>for blob in blobs:<EOL><INDENT>service.delete_blob(container_name='<STR_LIT>',<EOL>blob_name=blob.name)<EOL><DEDENT>
Creates a service SAS definition with access to a blob container.