Skip to content

extend Invoke-MgGraphRequest to handle PUT body / Unauthorized during build #483

Closed
@KaiWalter

Description

@KaiWalter

I need to PUT a body with this operation https://graph.microsoft.com/beta/identityGovernance/entitlementManagement/accessPackageAssignmentPolicies/{id} and get a 400 Bad Request although the same body works on the respective Graph API operation.

If I interpret InvokeMgGraphRequest.cs correctly, the body is just not added to the request stream for a PUT method operation.

I wanted to extend the CmdLet myself but already struggle with
.\tools\GenerateAuthenticationModule.ps1 -Build

which gives me an authentication error

WARNING: System.Collections.Hashtable
WARNING: 1.2.0
WARNING: Valid
WARNING: 1.2.0
WARNING: 1.2.0
Updated the .csproj.
Building 'Authentication' module...
Creating isolated process...
Cleaning build folders...
Compiling module...
C:\Program Files\dotnet\sdk\3.1.302\NuGet.targets(128,5): error : Failed to retrieve information about 'NETStandard.Library' from remote source 'https://pkgs.dev.azure.com/microsoftgraph/0985d294-5762-4bc2-a565-161ef349ca3e/_packaging/b395d603-5c77-4af9-a495-1e3cdbb49e1e/nuget/v2/FindPackagesById()?id='NETStandard.Library'&semVerLevel=2.0.0'. [C:\Users\kai\src\msgraph-sdk-powershell\src\Authentication\Authentication\Microsoft.Graph.Authentication.csproj]
C:\Program Files\dotnet\sdk\3.1.302\NuGet.targets(128,5): error :   Response status code does not indicate success: 401 (Unauthorized). [C:\Users\kai\src\msgraph-sdk-powershell\src\Authentication\Authentication\Microsoft.Graph.Authentication.csproj]
Write-Error: C:\Users\kai\src\msgraph-sdk-powershell\src\Authentication\Authentication\build-module.ps1:47
Line |
  47 |    Write-Error 'Compilation failed.'
     |    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Compilation failed.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions