Skip to content

Connect-graph: Value cannot be null, Parameter name: certificate #52

@ghost

Description

Hi
I'm testing out the msgraph-sdk-powershell and have installed the module. Using powershell 5.1.
I have Registered an App in my Azure and added a certificate that was created based on .\Create-SelfSignedCertificate.ps1 (https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-apponly-azuread)

When trying to connect I get the following error:

Connect-Graph -ClientId $clientId -TenantId $TenantId -CertificateName "CN=MyCompanyName"

Connect-Graph : Value cannot be null.
Parameter name: certificate
At line:2 char:1
+ Connect-Graph -ClientId $clientId -TenantId $TenantId -CertificateNam ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Connect-Graph], ArgumentNullException
    + FullyQualifiedErrorId : System.ArgumentNullException,Microsoft.Graph.PowerShell.Authentication.Cmdlets.ConnectGraph

I'm doing something wrong:s, but what?

Im able to get information via the app-registration using the
Invoke-RestMethod -Headers $Headers -Uri "https://graph.microsoft.com/v1.0/users/$UserPrincipalName/photo" -Method Get
Which means that the app registration and permissions are ok, perhaps I need to create a certificate another way?

Any tips are welcome!

brgs

Bjørn

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions