I am running the normal AzureAD commands from a new Azure VM which is behind firewall . I believe the required firewall ports are open to login.microsoftonline.com but cannot say for sure with the error message if its really a firewall issue. Has anyone faced the same exception and it turned out to be a firewall issue ?
Running below regular commands to connect.
import-module azureadpreview
Connect-AzureAD -TenantId $script:Tenantid -ApplicationId $script:ClientAppId -CertificateThumbprint $script:CertificateThumbprint
$allapps=Get-AzureADApplication -All 1
Exception Message:
Error Message: Error reading JToken from JsonReader. Path '', line 0, position 0.
Error StackTrace: at Newtonsoft.Json.Linq.JToken.ReadFrom(JsonReader reader, JsonLoadSettings settings)
at Newtonsoft.Json.Linq.JToken.Parse(String json, JsonLoadSettings settings)
at Microsoft.Open.AzureAD16.Client.Configuration.<>c.<.cctor>b__47_0(String methodName, IRestResponse response) in C:\__w\1\s\src\dev\PowerShell.V2\AzureAD16.Client\Client\Con
figuration.cs:line 147
at Microsoft.Open.AzureAD16.Api.ApplicationApi.GetApplicationsWithHttpInfo(String tenantId, String authorization, String cmdletName, String clientRequestId, String apiVersion,
String objectId, Nullable`1 all, Nullable`1 top, String skiptoken, String filter, String orderby) in C:\__w\1\s\src\dev\PowerShell.V2\AzureAD16.Client\Api\ApplicationApi.cs:line
2782
at Microsoft.Open.AzureAD16.PowerShell.GetApplications.ProcessRecord() in C:\__w\1\s\src\dev\PowerShell.V2\AzureAD16.PowerShell\AzureAD16.PowerShell.AutoGen\API\ApplicationApi
.cs:line 1010
at System.Management.Automation.Cmdlet.GetResults()
at System.Management.Automation.Cmdlet.<Invoke>d__40.MoveNext()
at System.Management.Automation.MshCommandRuntime._WriteObjectsSkipAllowCheck(Object sendToPipeline)
at System.Security.SecurityContext.Run(SecurityContext securityContext, ContextCallback callback, Object state)
at System.Management.Automation.MshCommandRuntime.WriteObject(Object sendToPipeline, Boolean enumerateCollection)
at System.Management.Automation.Cmdlet.WriteObject(Object sendToPipeline, Boolean enumerateCollection)
at Microsoft.Open.AzureAD16.PowerShell.GetApplication.ProcessRecord() in C:\__w\1\s\src\dev\PowerShell.V2\AzureAD16.PowerShell\AzureAD16.PowerShell.AutoGen\API\ApplicationApi.
cs:line 290
at System.Management.Automation.CommandProcessor.ProcessRecord()
I tried copying the AzureADpreview module again but no go.