32604

Error while fetching AAD app information using Get-AzureADApplication

Question:

I am trying to fetch AAD app info using "Get-AzureADApplication" command. but getting the below error-

Get-AzureADApplication : You must call the Connect-AzureAD cmdlet before calling any other cmdlets. At C:\Users\v-pasahu\Desktop\Sample.ps1:18 char:11 + if($app = Get-AzureADApplication -Filter "DisplayName eq '$($AppName) ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Get-AzureADApplication], AadNee dAuthenticationException + FullyQualifiedErrorId : Microsoft.Open.Azure.AD.CommonLibrary.AadNeedAuthe nticationException,Microsoft.Open.AzureAD16.PowerShell.GetApplication

Answer1:

According to the error message, you need to run the command Connect-AzureAD first.

Besides, if you do not <a href="https://docs.microsoft.com/en-us/powershell/azure/active-directory/install-adv2?view=azureadps-2.0" rel="nofollow">install azure powershell module</a>, you should install it before using azure ad powershell.

Answer2:

Looking at the comments you have said you want to run this in the non interactive flow. To do this you must follow the instructions here to log in as a <a href="https://docs.microsoft.com/en-us/powershell/azure/active-directory/signing-in-service-principal?view=azureadps-2.0" rel="nofollow">service principal</a>.

Alternatively depending on what you are trying to do you may find it easier to Login using the AzureRm cmdlets.

Recommend

  • PowerShell PSScriptRoot is null
  • Using expect to SSH to server and execute commands
  • How to display git branch in PS1 with other output?
  • VSTS Build fails/Publish fails to find roslyn\\csc.exe in the bin folder
  • Puzzled about Credential Details for Vertically Scaling SQL Azure using Azure Automation?
  • Using VSTS Rest API, how do you Update a Markdown widget?
  • Reusable MVC code: handling value types in linq expressions
  • Contains filter on Microsoft Graph query not working
  • Fading between images
  • passing parameter from aspx to javascript issue
  • Aggregating By Date in Mongodb
  • Advantage of 'one dimensional' hash over array in Perl
  • PowerShell execution policy subverted by powershell.exe parameter?
  • MVC: How do you give a viewmodel a list and correctly output it on .cshtml
  • powershell: script to start a program with parameters?
  • Set comboBox to custom display format
  • Add vcard to Contacts with Mail rules and Applescript
  • coldfusion variables into powershell
  • What does a hyphen at end of a term mean
  • smarty nested if condition is not working properly?
  • Sensibility of combined Maven/Ant+Ivy build management for dual platform Desktop/Android deployment?
  • JqueryMobile Popup menu is not working
  • Reading a file into a multidimensional array
  • Android application: how to use the camera and grab the image bytes?
  • MS Access - How to change the linked table path by amend the table
  • Appending Character to Character Array In C
  • dc-js disable selecting slices on click for pie chart
  • How to clear text inside text field when radio button is select
  • Scrapy recursive link crawler
  • Spring security and special characters
  • AES padding and writing the ciphertext to a disk file
  • Window Size for Mac application
  • Convert array of 8 bytes to signed long in C++
  • WOWZA + RTMP + HTML5 Playback?
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • retrieve vertices with no linked edge in arangodb
  • Linker errors when using intrinsic function via function pointer
  • LevelDB C iterator
  • Linking SubReports Without LinkChild/LinkMaster
  • Python/Django TangoWithDjango Models and Databases