diff --git a/src/get-list-of-azure-resource-groups-functionapp/GetListOfResourceGroups/__init__.py b/src/get-list-of-azure-resource-groups-functionapp/GetListOfResourceGroups/__init__.py index 944c177..933a13a 100644 --- a/src/get-list-of-azure-resource-groups-functionapp/GetListOfResourceGroups/__init__.py +++ b/src/get-list-of-azure-resource-groups-functionapp/GetListOfResourceGroups/__init__.py @@ -2,10 +2,7 @@ import os import azure.functions as func - -from azure.common.credentials import (ServicePrincipalCredentials, get_azure_cli_credentials) -from msrestazure.azure_active_directory import MSIAuthentication - +from azure.identity import DefaultAzureCredential from .resource_group_operations import list_rgs @@ -14,11 +11,7 @@ async def main(req: func.HttpRequest) -> func.HttpResponse: The main entry point to the function. """ - if "MSI_ENDPOINT" in os.environ: - credentials = MSIAuthentication() - else: - credentials, *_ = get_azure_cli_credentials() - + credentials = DefaultAzureCredential() subscription_id = os.environ.get( 'AZURE_SUBSCRIPTION_ID', '11111111-1111-1111-1111-111111111111')