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

Help with credentials cert #573

Open
chasquad opened this issue Aug 31, 2023 · 5 comments
Open

Help with credentials cert #573

chasquad opened this issue Aug 31, 2023 · 5 comments

Comments

@chasquad
Copy link

I'm trying to get this PS script ready to run: https://pnp.github.io/script-samples/spo-generate-sp-storage-savings-report/README.html?tabs=pnpps

I noticed that it has recently been updated so that it uses an app/cert for credentials.

I created the app, granted the app permissions, and now I just don't know what to do to fill in the variables for the script:

$UsingCertificate = $true
$clientID = "clientID"
$tenantId = "[tenant].onmicrosoft.com"
$certificatePassword = "pw"
$certificatePath = "C:\Users[you][centname].pfx"

I have the clientID from the app that was created. I also know my tenantid. What I'm having trouble understanding is where the "ceertificatePassword" and the "certificatePath" come from. In Entra, I can see the app and the cert information, but no file to download. I can download the manifest, but that downloads as a .json file.

So my questions are:

  1. Where is the certificatepassword? I know the app name, application ID, Client ID, Object ID, Directory ID, Tenant ID, Thumbprint, certificate ID, and Private key.
  2. How do I get the cert file? The script is looking for a path to a .pfx file.

Thanks!

@chasquad
Copy link
Author

I figured out the cert file issue. Now I have the one that was created on my local computer. I now just need to know what the value for the $certificatePassword" comes from.

@pkbullock
Copy link
Collaborator

pkbullock commented Aug 31, 2023 via email

@kasperbolarsen
Copy link
Collaborator

@chasquad
Copy link
Author

I used a PowerShell script to create the app registration, and that created the cert files. The script didn't have anything about a password ... so does that mean that I just leave the $certificatePassword" variable blank?

$result = Register-PnPAzureADApp -ApplicationName "CSPNP1" -Tenant mytenant.onmicrosoft.com -OutPath c:\mycertificates -DeviceLogin
$result

@ValerasNarbutas
Copy link
Contributor

@chasquad you might find this usefull
https://pnp.github.io/script-samples/spo-add-sppkg-ad-app-certificate/README.html?tabs=cli-m365-ps

top part is about creating cert with password

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

4 participants