Exemplo n.º 1
0
        public async Task <HttpResponseMessage> AddAppRoleRequest(string principalId, string ResourceId, string AppRoleId, CancellationToken token = default)
        {
            var azureAppRoleAssignment = new AzureAppRoleAssignmentDto
            {
                PrincipalId = principalId,
                ResourceId  = ResourceId,
                AppRoleId   = AppRoleId
            };

            var request = new AddAppRoleRequest(principalId, azureAppRoleAssignment);

            request.Headers.Authorization ??= GetAuthZHeader();
            var response = await SendAsync(request, token);

            return(response);
        }
Exemplo n.º 2
0
 public AddAppRoleRequest(string principalId, AzureAppRoleAssignmentDto azureAppRoleAssignment)
 {
     Content    = new StringContent(JsonSerializer.Serialize(azureAppRoleAssignment), Encoding.UTF8, "application/json");
     Method     = HttpMethod.Post;
     RequestUri = new Uri($"https://graph.microsoft.com/v1.0/users/{principalId}/appRoleAssignments");
 }