Jump to content

Recommended Posts

Posted

We have started encountering issues when attempting to authenticate with our MSGraph command. Whenever we issue the "Connect-MSGraph" command, we are prompted to enter our credentials (I'm using my M365 global admin account) and once I enter my MFA code, I am greeted with the following error:

AADSTS700016: Application with identifier '' was not found in the directory '

 

It appears that the app with that ID doesn't exist and I can't see it in the deleted items. I have attempted to re-create an app called "Microsoft Graph Command Line Tools", which has a new ID of . I've assigned my account permissions and given it access to "DeviceManagementManagedDevices.ReadWrite.All", "DeviceManagementConfiguration.ReadWrite.All", "DeviceManagementServiceConfig.ReadWrite.All" and "User.Read". Primarily because I'm trying to access Intune.

 

However, whenever I attempt to run "Connect-MSGraph" again, it's failing and showing . I don't know how this command knows which app ID to pull or how to change it to use the new app. Nor do I even know if I've re-created it correctly.

 

Although, I can use the command "Connect-AzureAD", which presents the same credentials box, where I can successfully authenticate with the same credentials and PS will connect to AzureAD.

Posted
Posted

That is the application ID! I wasn't sure if that was unique, hence why I excluded it. Searching for "Intune PowerShell" shows me the application with that application ID, so I don't know why it wouldn't appear when I searched for it via the ID alone.

 

I have confirmed that the account I am using has permissions to access the app, but I'm still getting the same error. I don't know why it can't locate the app within our tenant when I can view and edit it in the portal.

Posted

Thanks to information from @robk and this site: https://chanmingman.wordpress.com/2022/04/22/aadsts50011-the-redirect-uri-urnietfwgoauth2-0oob-specified-in-the-request-does-not-match-the-redirect-uris-configured-for-the-application/, I've managed to fix it by creating a new app registration in Entra admin > Applications > App registrations. Once created, I added API permissions for "DeviceManagementConfiguration.ReadWrite.All", "DeviceManagementManagedDevices.ReadWrite.All", "DeviceManagementServiceConfig.ReadWrite.All" and "User.Read", plus granted admin consent for our tenant. Then in Authentication, I added an authenication method for "Mobile and desktop applications Redirect URIs" and added an extra URI for "urn: ietf: wg: oauth: 2.0: oob" (spaces added because it created emojis), as that was specified in the new error message I was receiving. I also checked the box for "https://login.microsoftonline.com/common/oauth2/nativeclient", as that was also selected in the screenshot from Chanmingman's Blog. I then ran the command @robk mentioned "Update-MSGraphEnvironment -AppId .

 

Once all that was done, I was able to successfully authenticate via the Connect-MSGraph command and run some Intune commands.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...