Skip to content

Powershell Script: DeviceCodeCredential authentication failed #2901

@JHorvath-MaxetaTech

Description

@JHorvath-MaxetaTech

Doing a fresh install of Moodle 5.1.x wit the latest o365 plugins (PowerShell 7.5.4 with Azure CLI 2.78.0).

Here is some output of the error:

PowerShell 7.5.4
PS C:\Users\Maxeta\Desktop\Moodle-EntraID-PowerShell> .\Moodle-EntraID-Script.ps1
Deployment started...
Installing and importing required modules...
Module installation completed
Connecting to Microsoft Graph...
Connected to Microsoft Graph
Scopes: Application.ReadWrite.All, Directory.AccessAsUser.All, Directory.Read.All, openid, profile, User.ReadWrite.All, email
Enter the Microsoft Entra ID app name (ex: Moodle plugin): Moodle
Enter the URL of your Moodle server (ex: https://www.moodleserver.com): https://moodle.mycompany.com
Creating application with display name: Moodle510
New-MgApplication_CreateExpanded: C:\Users\Maxeta\Desktop\Moodle-EntraID-PowerShell\Moodle-EntraID-Script.ps1:349
Line |
 349 |              $newApp = New-MgApplication @basicParams
     |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | DeviceCodeCredential authentication failed: Object reference not set to an instance of an object.
Attempt 1 of 5 failed. Retrying in 3 seconds...
Creating application with display name: Moodle510
New-MgApplication_CreateExpanded: C:\Users\Maxeta\Desktop\Moodle-EntraID-PowerShell\Moodle-EntraID-Script.ps1:349
Line |
 349 |              $newApp = New-MgApplication @basicParams
     |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | DeviceCodeCredential authentication failed: Object reference not set to an instance of an object.
Attempt 2 of 5 failed. Retrying in 3 seconds...
Creating application with display name: Moodle510
New-MgApplication_CreateExpanded: C:\Users\Maxeta\Desktop\Moodle-EntraID-PowerShell\Moodle-EntraID-Script.ps1:349
Line |
 349 |              $newApp = New-MgApplication @basicParams
     |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | DeviceCodeCredential authentication failed: Object reference not set to an instance of an object.
Attempt 3 of 5 failed. Retrying in 3 seconds...
Creating application with display name: Moodle510
New-MgApplication_CreateExpanded: C:\Users\Maxeta\Desktop\Moodle-EntraID-PowerShell\Moodle-EntraID-Script.ps1:349
Line |
 349 |              $newApp = New-MgApplication @basicParams
     |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | DeviceCodeCredential authentication failed: Object reference not set to an instance of an object.
Attempt 4 of 5 failed. Retrying in 3 seconds...
Creating application with display name: Moodle510
New-MgApplication_CreateExpanded: C:\Users\Maxeta\Desktop\Moodle-EntraID-PowerShell\Moodle-EntraID-Script.ps1:349
Line |
 349 |              $newApp = New-MgApplication @basicParams
     |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | DeviceCodeCredential authentication failed: Object reference not set to an instance of an object.
Application creation failed after 5 attempts: Application creation failed - no application object returned
Deployment failed: Application creation failed - no application object returned

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions