Skip to content
This repository was archived by the owner on Jan 19, 2021. It is now read-only.

Commit 8427542

Browse files
committed
Fixes issue #2853
1 parent e8b5649 commit 8427542

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Commands/Base/InitializePowerShellAuthentication.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44
using PnP.PowerShell.CmdletHelpAttributes;
55
using PnP.PowerShell.Commands.Model;
66
using PnP.PowerShell.Commands.Utilities;
7+
using PnP.PowerShell.Commands.Utilities.REST;
78
using System;
89
using System.Collections.Generic;
910
using System.IO;
1011
using System.Linq;
1112
using System.Management.Automation;
1213
using System.Management.Automation.Host;
14+
using System.Net.Http;
1315
using System.Security;
1416
using System.Security.Cryptography;
1517
using System.Security.Cryptography.X509Certificates;
@@ -242,8 +244,9 @@ protected override void ProcessRecord()
242244
},
243245
requiredResourceAccess = scopesPayload
244246
};
245-
var postResult = HttpHelper.MakePostRequestForString("https://graph.microsoft.com/beta/applications", payload, "application/json", token);
246-
var azureApp = JsonSerializer.Deserialize<AzureApp>(postResult);
247+
var requestContent = new StringContent(JsonSerializer.Serialize(payload));
248+
requestContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
249+
var azureApp = GraphHelper.PostAsync<AzureApp>(new System.Net.Http.HttpClient(), "/beta/applications", requestContent, token).GetAwaiter().GetResult();
247250
record.Properties.Add(new PSVariableProperty(new PSVariable("AzureAppId", azureApp.AppId)));
248251

249252
var waitTime = 60;

0 commit comments

Comments
 (0)