<gh_stars>0
import os
from azure.identity import DefaultAzureCredential
from azure.identity import VisualStudioCodeCredential
from azure.identity import InteractiveBrowserCredential
from azure.mgmt.resource import SubscriptionClient
from azure.storage.blob import BlobServiceClient, BlobClient, ContainerClient, __version__

# Import the client object from the SDK library
from azure.storage.blob import BlobClient

## Easiest
# https://github.com/Azure/azure-sdk-for-net/issues/13228
credential = DefaultAzureCredential(exclude_shared_token_cache_credential=True)
#credential = VisualStudioCodeCredential()

# Who is making this request
subscription_client = SubscriptionClient(credential)
subscription = next(subscription_client.subscriptions.list())
print(subscription.id)
#print(subscription.subscription_id)
#print(subscription.display_name)

# Docs
# https://docs.microsoft.com/en-us/azure/app-service/scenario-secure-app-access-storage?tabs=azure-portal%2Cprogramming-language-csharp

# Retrieve the storage blob service URL, which is of the form
# https://pythonsdkstorage12345.blob.core.windows.net/
storage_url = 'https://vmagelopythonflask.blob.core.windows.net/'
container_name = 'blob-container-01'
print(credential)

container_client = ContainerClient(account_url=storage_url, container_name=container_name, credential=credential)
try:
    # List the blobs in the container
    blob_list= container_client.list_blobs()
    bloblist = ''
    for blob in blob_list:
        bloblist += blob.name + ' '

except Exception as ex:
    print(ex)
    bloblist = 'error'

print(bloblist)
import os
from azure.identity import DefaultAzureCredential
from azure.identity import VisualStudioCodeCredential
from azure.identity import InteractiveBrowserCredential
from azure.mgmt.resource import SubscriptionClient
from azure.storage.blob import BlobServiceClient, BlobClient, ContainerClient, __version__

# Import the client object from the SDK library
from azure.storage.blob import BlobClient

## Easiest
# https://github.com/Azure/azure-sdk-for-net/issues/13228
credential = DefaultAzureCredential(exclude_shared_token_cache_credential=True)
#credential = VisualStudioCodeCredential()

# Who is making this request
subscription_client = SubscriptionClient(credential)
subscription = next(subscription_client.subscriptions.list())
print(subscription.id)
#print(subscription.subscription_id)
#print(subscription.display_name)

# Docs
# https://docs.microsoft.com/en-us/azure/app-service/scenario-secure-app-access-storage?tabs=azure-portal%2Cprogramming-language-csharp

# Retrieve the storage blob service URL, which is of the form
# https://pythonsdkstorage12345.blob.core.windows.net/
storage_url = 'https://vmagelopythonflask.blob.core.windows.net/'
container_name = 'blob-container-01'
print(credential)

container_client = ContainerClient(account_url=storage_url, container_name=container_name, credential=credential)
try:
    # List the blobs in the container
    blob_list= container_client.list_blobs()
    bloblist = ''
    for blob in blob_list:
        bloblist += blob.name + ' '

except Exception as ex:
    print(ex)
    bloblist = 'error'

print(bloblist)
# Import the client object from the SDK library ## Easiest # https://github.com/Azure/azure-sdk-for-net/issues/13228 #credential = VisualStudioCodeCredential() # Who is making this request #print(subscription.subscription_id) #print(subscription.display_name) # Docs # https://docs.microsoft.com/en-us/azure/app-service/scenario-secure-app-access-storage?tabs=azure-portal%2Cprogramming-language-csharp # Retrieve the storage blob service URL, which is of the form # https://pythonsdkstorage12345.blob.core.windows.net/ # List the blobs in the container