microsoftgraph / msgraph-sdk-serviceissues

Tracks service issues for follow up.
5 stars 0 forks source link

Cannot create Team with External Azure Active Directory User as Global Admin #97

Open fuocor opened 3 years ago

fuocor commented 3 years ago

Describe the bug I am trying to create a Team using a token from a user (member) from an external AzAD that is in the global admin role for the target directory.

The PublicClientApplication is in the target directory and the Group.ReadWrite.All, Directory.ReadWrite.All have been admin consented.

The account can create and manage the Group but fails on the Team. If I use a local member account that is in Global Admin then it works.

To Reproduce


var msGraphResult = await publicClientApplication
    .AcquireTokenSilent(new[] { "https://graph.microsoft.com/.default" }, runtimeContext.AuthenticationResult.Account)
    .WithForceRefresh(true)
    .ExecuteAsync();

var authenticationHeaderValue = new AuthenticationHeaderValue("bearer", msGraphResult.AccessToken);
var graphServiceClient = new GraphServiceClient(new DelegateAuthenticationProvider((requestMessage) =>
{
    requestMessage.Headers.Authorization = authenticationHeaderValue;
    return Task.CompletedTask;
}));

var team = new Team()
{
    GuestSettings = new TeamGuestSettings
    {
        AllowCreateUpdateChannels = false,
        AllowDeleteChannels = false,
        ODataType = null,
    },
    MemberSettings = new TeamMemberSettings
    {
        AllowCreateUpdateChannels = false,
        ODataType = null,
    },
    MessagingSettings = new TeamMessagingSettings
    {
        AllowUserEditMessages = true,
        AllowUserDeleteMessages = true,
        ODataType = null,
    },
    FunSettings = new TeamFunSettings
    {
        AllowGiphy = true,
        GiphyContentRating = GiphyRatingType.Strict,
        ODataType = null,
    },
    ODataType = null,
};

await graphServiceClient.Groups[group.Id]
    .Team
    .Request()
    .WithMaxRetry(3)
    .PutAsync(team);

Expected behavior Creates a team

Screenshots

fail: Chorus.Actors.Applications.ChorusApplications.AzureAdApplication[1]
      EnsureMicrosoftTeamsAsync has faulted with error: Code: BadGateway
      Message: Failed to execute backend request.
      Inner error:
        AdditionalData:
        date: 2020-07-08T00:21:32
        request-id: <guid>
      ClientRequestId: <guid>
       BadGateway
Status Code: BadGateway
Microsoft.Graph.ServiceException: Code: BadGateway
Message: Failed to execute backend request.
Inner error:
        AdditionalData:
        date: 2020-07-08T00:21:32
        request-id: <guid>
ClientRequestId: <guid>

   at Microsoft.Graph.HttpProvider.SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken)
   at Microsoft.Graph.BaseRequest.SendRequestAsync(Object serializableObject, CancellationToken cancellationToken, HttpCompletionOption completionOption)
   at Microsoft.Graph.BaseRequest.SendAsync[T](Object serializableObject, CancellationToken cancellationToken, HttpCompletionOption completionOption)
   at Microsoft.Graph.TeamRequest.PutAsync(Team teamToCreate, CancellationToken cancellationToken)
   at Chorus.Actors.Applications.ChorusApplications.AzureAdApplication.EnsureMicrosoftTeamsAsync(IEnumerable`1 userRoleAssignments) in D:\ossiaco\chorus\src\Chorus\src\Actors\Applications\ChorusApplications\AzureAdApplication.cs:line 263

Desktop (please complete the following information):

MIchaelMainer commented 3 years ago

@nkramer

petrhollayms commented 2 months ago

Thank you for reporting this issue. This appears to be an issue or limitation with the service APIs. Unfortunately, as the Microsoft Graph SDK team, we do not have ownership of the APIs that are causing you issues. We invite you to create a question about the service API to Microsoft Q&A and tagged with one of the [microsoft-graph-*] tags, that way it will get routed to the appropriate team for them to triage:

https://aka.ms/msgraphsupport or directly https://aka.ms/askgraph

For now, we will close the issue on our side but feel free to open it in the relevant repository if you think the issue is specific to SDK. Please let us know if this helps!

Note: We will close this repository on April 19, 2024.