Skip to content

Commit 74013d6

Browse files
Test new format
1 parent 6b83daa commit 74013d6

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

articles/storage/blobs/storage-blob-container-delete-python.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,16 @@ This article shows how to delete containers with the [Azure Storage client libra
2121

2222
To learn about deleting a blob container using asynchronous APIs, see [Delete a container asynchronously](#delete-a-container-asynchronously).
2323

24-
## Prerequisites
24+
[!INCLUDE [storage-dev-guide-prereqs-python](../../../includes/storage-dev-guides/storage-dev-guide-prereqs-python.md)]
2525

26-
- This article assumes you already have a project set up to work with the Azure Blob Storage client library for Python. To learn about setting up your project, including package installation, adding `import` statements, and creating an authorized client object, see [Get started with Azure Blob Storage and Python](storage-blob-python-get-started.md).
27-
- The [authorization mechanism](../common/authorize-data-access.md) must have permissions to delete a blob container, or to restore a soft-deleted container. To learn more, see the authorization guidance for the following REST API operations:
28-
- [Delete Container](/rest/api/storageservices/delete-container#authorization)
29-
- [Restore Container](/rest/api/storageservices/restore-container#authorization)
26+
## Set up your environment
27+
28+
| Setup task | Guidance |
29+
|---|---|
30+
| Install packages | `pip install azure-storage-blob azure-identity` |
31+
| Add import statements | :::code language="python" source="~/azure-storage-snippets/blobs/howto/python/blob-devguide-py/blob_devguide_delete_container.py" id="Snippet_imports"::: |
32+
| Authorization | The authorization mechanism must have the necessary permissions to delete a blob container, or to restore a soft-deleted blob container. For authorization with Microsoft Entra ID (recommended), you need Azure RBAC built-in role **Storage Blob Data Contributor** or higher. To learn more, see the authorization guidance for [Delete Container (REST API)](/rest/api/storageservices/delete-container#authorization) or [Restore Container (REST API)](/rest/api/storageservices/restore-container#authorization). |
33+
| Create a client | [!INCLUDE [storage-dev-guide-create-client-python](../../../includes/storage-dev-guides/storage-dev-guide-create-client-python.md)] |
3034

3135
## Delete a container
3236

includes/storage-dev-guides/storage-dev-guide-create-client-python.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,12 @@ ms.custom: include file
1515
To connect an app to Blob Storage, create an instance of [BlobServiceClient](/python/api/azure-storage-blob/azure.storage.blob.blobserviceclient). The following example shows how to create a client object using `DefaultAzureCredential` for authorization:
1616

1717
```python
18-
def get_blob_service_client_token_credential(self):
19-
# TODO: Replace <storage-account-name> with your actual storage account name
20-
account_url = "https://<storage-account-name>.blob.core.windows.net"
21-
credential = DefaultAzureCredential()
18+
# TODO: Replace <storage-account-name> with your actual storage account name
19+
account_url = "https://<storage-account-name>.blob.core.windows.net"
20+
credential = DefaultAzureCredential()
2221

23-
# Create the BlobServiceClient object
24-
blob_service_client = BlobServiceClient(account_url, credential=credential)
25-
26-
return blob_service_client
22+
# Create the BlobServiceClient object
23+
blob_service_client = BlobServiceClient(account_url, credential=credential)
2724
```
2825

2926
You can also create client objects for specific [containers](../../articles/storage/blobs/storage-blob-client-management.md#create-a-blobcontainerclient-object) or [blobs](../../articles/storage/blobs/storage-blob-client-management.md#create-a-blobclient-object). To learn more about creating and managing client objects, see [Create and manage client objects that interact with data resources](../../articles/storage/blobs/storage-blob-client-management.md).

0 commit comments

Comments
 (0)