Open paylocity-sflanders opened 6 years ago
@darshanhs90 Hey Haridarshan, would you mind taking a look at this issue?
Hi There - Looks like I'm also going through the same issue. When I loop through multiple data factories to add it to Key Vault access policies, I'm able to retrieve MSI without any issue for the first 2 data factories and after that its returning NULL for rest of the iterations. (Get-AzureRmADServicePrincipal -ObjectId $datafactory.Identity.PrincipalId).ApplicationId
Description
I noticed that on some of our servers Get-AzureRmADServicePrincipal would not always return service principal info even though the user was able to login using Add-AzureRmAccount. After doing some investigating and building a quick protoype it appears we were getting "The underlying connection was closed: An unexpected error occurred on a send." but the powershell module doesn't report that as error it just doesn't return a response.
Script/Steps for Reproduction
Simply installed AzureRM version 5.0.1 or beyond run Add-AzureRmAccount for service principal run Get-AzureRmADServicePrincipal for service principal if the firewall is blocking "graph.windows.net" you won't get an error even if ErrorAction Stop is added, it just doesn't return data which is not proper behavior.
Module Version
I tested with AzureRM 5.0.1 and 5.2.0
Environment Data
Debug Output