Read and instantiated environment variables by using load_env() as below. Depending on what you are doing, you may or may not need some of the variables.
Created a Media Services client as below.
from dotenv import load_dotenv
from azure.identity import DefaultAzureCredential
from azure.mgmt.media import AzureMediaServices
from azure.mgmt.media.models import (
AccountFilter,
FirstQuality,
AssetFilter
)
import os
# Create the Media Services client and authenticate using the DefaultAzureCredential
default_credential = DefaultAzureCredential()
client = AzureMediaServices(default_credential, subscription_id)
# From SDK:
# list(resource_group_name: str, account_name: str, **kwargs: Any) -> Iterable[azure.mgmt.media.models._models_py3.AccountFilterCollection]
def list_account_filter(resource_group_name, account_name):
results = client.account_filters.list(resource_group_name, account_name)
# For this sample, we are printing the list of all account filters in the current Media Services Account
for filter in results:
#For each of the filters, print its name.
print(filter.name)
list_account_filter(resource_group_name, account_name)