Skip to content

Connect-Graph: Cert based authentication errors, documentation and error handling #162

Closed

Description

Just tried to implement an application based workflow using the module and was facing an issue that was driving me nuts:
No matter what I tried, when running Connect-Graph it would complain about the parameter certificate being null.

I finally managed to solve the problem (after tracing the sourcecode), so here's what I learned from my ordeal:

  • The command is in desperate need for some help. Happy to help with that and some automation behind it, assuming I can find the time.
  • It looks for the certificate in the user store, but not in the computer store. This is a handicap for when I set up a task that is designed to run under a different account than my test account.
  • The parameter "CertificateName" should probably be renamed to "CertificateSubject"
  • Some front-up input validation during begin would allow a lot more user-friendly error messages.

On my feature-wishlist for the command:

  • Add a -Certificate parameter to the command, that accepts a X509Certificate2 object.
  • Add a -CertificatePath and a -CertificatePassword parameter, to enable pointing at a PFX file.
  • Remove the need to provide both CertificateName and CertificateThumbprint. It's redundant and if the user can provide the thumbprint, it doesn't use the name anyway.
    AB#7442

Activity

  1. ghost removed on Apr 1, 2020
  2. DSotnikov commented on Jul 31, 2020

    @DSotnikov

    So if I want to use certificate to authenticate when connecting to Microsoft Graph, am I right in understanding that the flow needs to be the following:

    1. Generate a certificate (can be self-signed)
    2. Register an app in Azure with that certificate and grant it permissions: basically steps 1 & 2 from https://docs.microsoft.com/en-us/graph/auth-v2-service
    3. Store that certificate in the user store on the machine on which I run my scheduled task as described above by Friedrich Weinmann (@FriedrichWeinmann)
  3. georgend commented on May 5, 2021

    @georgend
    Contributor
  4. peombwa commented on May 5, 2021

    @peombwa
    Member

    #440 added this in 1.2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions