Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asking to call connect-mggraph #7

Closed
thiagobeier opened this issue Jul 14, 2023 · 1 comment
Closed

asking to call connect-mggraph #7

thiagobeier opened this issue Jul 14, 2023 · 1 comment

Comments

@thiagobeier
Copy link
Contributor

run the following:

.\get-windowsautopilotinfo.ps1 -Hybrid -TenantId 111111 -AppId 22222 -AppSecret 33333 -AssignedComputerName "USAL-DEVICE1" -AddToGroup "USAL-AADJ" -Reboot -verbose

then goes:

Select-MgProfile : The term 'Select-MgProfile' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\temp\get-windowsautopilotinfo.ps1:1890 char:13

  •         Select-MgProfile -Name Beta
    
  •         ~~~~~~~~~~~~~~~~
    
    • CategoryInfo : ObjectNotFound: (Select-MgProfile:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

Connect-MgGraph : Cannot bind parameter 'AccessToken'. Cannot convert the

then connects

At C:\temp\get-windowsautopilotinfo.ps1:1891 char:52

  •         $graph = Connect-MgGraph  -AccessToken $accessToken
    
  •                                                ~~~~~~~~~~~~
    
    • CategoryInfo : InvalidArgument: (:) [Connect-MgGraph], ParameterBindingException
    • FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.Graph.PowerShell.Authentication.Cmdlets.ConnectMgGraph

Connected to Intune tenant 1111111111111111-22222-33333-44444-555555555555555 using app-based authentication (Azure AD authentication not supported)

and throws the error

Add-AutopilotImportedDevice : Microsoft.Graph.PowerShell.AuthenticationException: Authentication needed. Please call Connect-MgGraph.
at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)
At C:\temp\get-windowsautopilotinfo.ps1:2026 char:26

  • ... imported += Add-AutopilotImportedDevice -serialNumber $_.'Device Seri ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
    • FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Add-AutopilotImportedDevice

if you stay on the same screen on the fresh device / VM

and run Connect-MgGraph

than re-run enrollment parameters works

.\get-windowsautopilotinfo.ps1 -Hybrid -TenantId 111111 -AppId 22222 -AppSecret 33333 -AssignedComputerName "USAL-DEVICE1" -AddToGroup "USAL-AADJ" -Reboot -verbose

after that device is ok and has its device name added to the windows autopilot device object, also has its GroupTag and get the windows autopilot deployment profile assigned as well as gets the proper DeviceName from AssignedComputerName parameter.

thanks,
Thiago Beier

@andrew-s-taylor
Copy link
Owner

You need to use the community version, this one hasn't been updated to work with v2 of the sdk

@andrew-s-taylor andrew-s-taylor closed this as not planned Won't fix, can't repro, duplicate, stale Jul 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants