private static async Task CallContainerSamples(CloudBlobContainer container)
{
// Fetch container attributes in order to populate the container's properties and metadata.
await container.FetchAttributesAsync();
// Read container metadata and properties.
PrintContainerPropertiesAndMetadata(container);
// Add container metadata.
await AddContainerMetadataAsync(container);
// Fetch the container's attributes again, and read container metadata to see the new additions.
await container.FetchAttributesAsync();
PrintContainerPropertiesAndMetadata(container);
// Make the container available for public access.
// With Container-level permissions, container and blob data can be read via anonymous request.
// Clients can enumerate blobs within the container via anonymous request, but cannot enumerate containers.
await SetAnonymousAccessLevelAsync(container, BlobContainerPublicAccessType.Container);
// Try an anonymous operation to read container properties and metadata.
Uri containerUri = container.Uri;
// Note that we obtain the container reference using only the URI. No account credentials are used.
CloudBlobContainer publicContainer = new CloudBlobContainer(containerUri);
Console.WriteLine("Read container metadata anonymously");
await container.FetchAttributesAsync();
PrintContainerPropertiesAndMetadata(container);
// Make the container private again.
await SetAnonymousAccessLevelAsync(container, BlobContainerPublicAccessType.Off);
// Test container lease conditions.
// This code creates and deletes additional containers.
await ManageContainerLeasesAsync(container.ServiceClient);
}