Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DefaultAzureCredential can take care of the authenticating the function #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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')

Expand Down