microsoftgraph / microsoftgraph/msgraph-beta-sdk-python

sign_ins.get does not support the filter properties from Docs

Abierto
#828 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

status:waiting-for-triage type:bug
Lenguaje dominante
Python
Estrellas
44
Forks
16
Merge medio
20 h 39 min
PR fusionados (30 d)
3

Descripción

Describe the bug

When attempting to get nonInteractiveUser and servicePrincipal sign-ins, we receive one the following error messages when we try to use the filter properties defined in the Official MSgraph Beta API documentation.

"Invalid filter clause: Could not find a property named 'servicePrincipalId' on type 'microsoft.graph.signIn'."

Invalid filter clause: Could not find a property named 'signInEventTypes' on type 'microsoft.graph.signIn'.", target=None)

Here are some example filters we have tried

filter_query = f"createdDateTime ge {start_time_str} and createdDateTime le {end_time_str} and signInEventTypes/any(t: t eq 'nonInteractiveUser' or t eq 'servicePrincipal')"

filter_query = "signInEventTypes/any(t: t eq 'nonInteractiveUser' or t eq 'servicePrincipal')"

filter_query = f"servicePrincipalId eq '{id}'"

Notes:

  1. This exact same code works fine via the Python Beta SDK if we only include the createdDateTime properties in the filter
  2. This exact same filter (including signInEventTypes/any property) works fine when used via the MSGraph Beta API over HTTP

Questions

  1. I understand this is a beta, but should we expect the Python SDK to behave differently from the Beta Docs and the Beta HTTP API?
Expected behavior
  1. The python beta SDK would support the same filter properties as documented in the MSGraph Beta API documentation
  2. The python beta SDK would support the same filter properties as the MSGraph Beta HTTP API
How to reproduce
import asyncio
import os

from azure.identity import InteractiveBrowserCredential
from kiota_abstractions.base_request_configuration import RequestConfiguration
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.audit_logs.sign_ins.sign_ins_request_builder import (
    SignInsRequestBuilder,
)

AZURE_TENANT_ID = os.environ.get("AZURE_TENANT_ID")
CERT = os.environ.get("CERT_PATH")


async def get_sign_ins(client):
    """Get sign-ins with SDK"""

    filter_query = (
        "signInEventTypes/any(t: t eq 'nonInteractiveUser' or t eq 'servicePrincipal')"
    )

    query_params = SignInsRequestBuilder.SignInsRequestBuilderGetQueryParameters(
        filter=filter_query,
        top=1,
    )

    request_configuration = RequestConfiguration(
        query_parameters=query_params,
    )
    result = await client.audit_logs.sign_ins.get(
        request_configuration=request_configuration
    )

    return result.value


async def main():
    """Main async function to process sign-ins"""

    credential = InteractiveBrowserCredential(
        tenant_id=AZURE_TENANT_ID, connection_verify=CERT
    )
    client = GraphServiceClient(
        credential,
        scopes=["https://graph.microsoft.com/.default"],
    )
    result = await get_sign_ins(client)
    print(result)


if __name__ == "__main__":
    asyncio.run(main())

SDK Version

1.31.0

Latest version known to work for scenario above?

No response

Known Workarounds

Use HTTP to hit beta API via python requests library

Debug output

"Invalid filter clause: Could not find a property named 'signInEventTypes' on type 'microsoft.graph.signIn'."

Configuration
  • OS: macOS Sequoia 15.3.1
  • Architecture: M1 ARM
Other information

No response

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza con el punto de entrada generado audit_logs/sign_ins/sign_ins_request_builder.py utilizado por SignInsRequestBuilder e inspecciona cómo la solicitud GET construye su consulta de filtros. Compara la solicitud del SDK con la solicitud HTTP beta documentada utilizando los filtros de reproducción. Se considera terminado cuando los filtros signInEventTypes y servicePrincipalId se acepten a través del Python SDK.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
api
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.