Topic: AZ-204 topic 4 question 60

HOTSPOT
-

You develop a web app that interacts with Azure Active Directory (Azure AD) groups by using Microsoft Graph.

You build a web page that shows all Azure AD groups that are not of the type 'Unified'.

You need to build the Microsoft Graph query for the page.

How should you complete the query? To answer, select the appropriate options in the answer area.

NOTE: Each correct selection is worth one point.

Re: AZ-204 topic 4 question 60

~/groups?$filter=NOT groupTypes/any(c:c eq 'Unified')&$count=true

This exact example is mentioned in Microsoft documentation:
https://learn.microsoft.com/en-us/graph/filter-query-parameter?tabs=http#examples-using-the-filter-query-operator

Re: AZ-204 topic 4 question 60

Agree. if you try:"$filter=groupTypes/any(s:s ne 'Unified')&$count=true", you get: "Using 'ne' inside 'any' clause is invalid. Suggestion: consider using the 'not' operator instead."

Re: AZ-204 topic 4 question 60

=> https://learn.microsoft.com/en-us/graph/filter-query-parameter?tabs=http#examples-using-the-filter-query-operator:~:text=~/groups%3F%24filter%3DNOT%20groupTypes/any(c%3Ac%20eq%20%27Unified%27)%26%24count%3Dtrue

Re: AZ-204 topic 4 question 60

Not sure since then but now it supports the ne parameter too:

"As Microsoft Entra ID continues to deliver more capabilities and improvements in stability, availability, and performance, Microsoft Graph also continues to evolve and scale to efficiently access the data. One way is through Microsoft Graph's increasing support for advanced query capabilities on various Microsoft Entra ID objects, also called directory objects, and their properties. For example, the addition of not (not), not equals (ne), and ends with (endsWith) operators on the $filter query parameter."
https://learn.microsoft.com/en-us/graph/aad-advanced-queries?tabs=http#count-of-a-collection-in-a-filter-expression

Re: AZ-204 topic 4 question 60

it is correct
https://learn.microsoft.com/en-us/azure/cosmos-db/how-to-always-encrypted?tabs=dotnet

Re: AZ-204 topic 4 question 60

Agreed, it's correct, but here're the links with explanation
https://learn.microsoft.com/en-us/graph/filter-query-parameter?tabs=http#any-operator
https://learn.microsoft.com/en-us/graph/aad-advanced-queries

Re: AZ-204 topic 4 question 60

It's D

The 'ne' is not supported by default, we need count=true AND consistency level set to eventual which is not possible with this question.

Re: AZ-204 topic 4 question 60

This works OK in graph: https://graph.microsoft.com/v1.0/groups?$filter=groupTypes/any(c:c eq 'Unified')

Re: AZ-204 topic 4 question 60

ne (Not Equals) is now supported.

Re: AZ-204 topic 4 question 60

From documentation (https://learn.microsoft.com/en-us/graph/filter-query-parameter?tabs=http#examples-using-the-filter-query-operator):
List all non-Microsoft 365 groups in an organization.
GET ~/groups?$filter=NOT groupTypes/any(c:c eq 'Unified')&$count=true*

Re: AZ-204 topic 4 question 60

got this question on 06/29/2023

Re: AZ-204 topic 4 question 60

Got this answer on 06-29-2023

Re: AZ-204 topic 4 question 60

Just try it yourself here: https://developer.microsoft.com/en-us/graph/graph-explorer
https://graph.microsoft.com/v1.0/groups?$filter=groupTypes/any(s:s ne 'Unified')&$count=true -> 400
https://graph.microsoft.com/v1.0/groups?$filter=not groupTypes/contains('Unified')&$count=true -> 400
https://graph.microsoft.com/v1.0/groups?$filter=not groupTypes/any(s:s eq 'Unified')&$count=true -> 200 with ConsistencyLevel: eventual
https://graph.microsoft.com/v1.0/groups?$filter=groupTypes/contains('Unified') eq false&$count=true -> 400

Re: AZ-204 topic 4 question 60

Now it works fine.

Re: AZ-204 topic 4 question 60

From Microsoft documentation https://learn.microsoft.com/en-us/graph/filter-query-parameter?tabs=http#examples-using-the-filter-query-operator
List all non-Microsoft 365 groups in an organization.    GET ~/groups?$filter=NOT groupTypes/any(c:c eq 'Unified')&$count=true*

Re: AZ-204 topic 4 question 60

any idea why $count=true though?

Re: AZ-204 topic 4 question 60

Answer ~/groups?$filter=NOT groupTypes/any(c:c eq 'Unified')&$count=true

Option 2: Use the $filter query parameter with the ne operator. This request is not supported by default because the ne operator is only supported in advanced queries. Therefore, you must add the ConsistencyLevel header set to eventual and use the $count=true query string.

https://learn.microsoft.com/en-us/graph/aad-advanced-queries?tabs=http

Re: AZ-204 topic 4 question 60

Answer: /groups?$filter=not groupTypes/any(s:s eq 'Unified')&$count=true
It also requires an extra header
ConsistencyLevel: eventual

"ne" is not supported.

message": "Using 'ne' inside 'any' clause is invalid. Suggestion: consider using the 'not' operator instead. For example: $filter=not groupTypes/any(x:x eq 'Unified')

Re: AZ-204 topic 4 question 60

I don't think so. I see if you want to use negative this way, you have to set parenthesis after not. like this: /groups$filter=not(groupTypes/any(s:s eq 'Unified'))

Re: AZ-204 topic 4 question 60

IMO it should be filter=NOT groupTypes/any(s:s eq 'Unified')&$count=true.
Source: https://learn.microsoft.com/en-us/azure/cosmos-db/how-to-always-encrypted?tabs=dotnet

In advanced querries you can also use the ne operator but then the consistencylevel has to be put to eventual and I'm not sure that's the case here?

Re: AZ-204 topic 4 question 60

The answer is wrong! 1. filter should be $filter, and the expression should be NOT groupTypes/any(s:s ne 'Unified'), we want records that are NOT unified, see examples at https://learn.microsoft.com/en-us/graph/filter-query-parameter?tabs=http