GitHub user dabla added a comment to the discussion: Microsoft Graph API - 
Scopes should be an empty list or a list of strings Error

> > Based off of the following being line 298, not line 305, going to guess 
> > version is outdated. `File 
> > "/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/microsoft/azure/hooks/msgraph.py",
> >  line 298, in get_conn auth_provider = AzureIdentityAuthenticationProvider(`
> 
> I thought it was the latest one.
> 
> Im taking as reference for my code the following: 
> https://airflow.apache.org/docs/apache-airflow-providers-microsoft-azure/stable/connections/msgraph.html
> 
> ```
> from airflow import DAG
> from airflow.providers.microsoft.azure.operators.msgraph import 
> MSGraphAsyncOperator
> from airflow.providers.http.operators.http import HttpOperator
> from datetime import datetime
> 
> with DAG(
>     dag_id="graph_email_production",
>     start_date=datetime(2025,4,7),
>     schedule_interval=None
> ) as dag:
> 
>     send_email = MSGraphAsyncOperator(
>         task_id="send_email",
>         conn_id="azure_graph_email",
>         method="POST",
>         url="/v1.0/users/[email protected]/sendMail", 
>         data={
>             "message": {
>                 "subject": "Test from Airflow - {{ ds }}",
>                 "body": {
>                     "contentType": "HTML",
>                     "content": """
>                     <h1>Airflow Notification</h1>
>                     <p>Execution time: {{ ts }}</p>
>                     """
>                 },
>                 "toRecipients": [{
>                     "emailAddress": {"address": 
> "[email protected]"}
>                 }]
>             }
>         }
>     )
> ```

Code in the DAG looks fine, you don't even specify a scope so weird you got 
this issue.

But you shouldn't specify the version in the url, as this is done 
automatically, so it should be:

`url="users/[email protected]/sendMail", `

GitHub link: 
https://github.com/apache/airflow/discussions/64624#discussioncomment-16421913

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to