Maintain control of your Microsoft 365 data
chrisflyckelen
Service Provider
Posts: 80 Liked: 11 times
Joined: Oct 15, 2019 7:51 am
Full Name: Christian van Eickelen
Contact:
Post
by chrisflyckelen » Nov 28, 2022 7:37 pm
this post
Hey guys,
i'm struggling to add an Office 365 organization to VBO365 by using PowerShell. To do that I would like to use the modern-app authentication mode.
As noted in the helpcenter docs the cmdlet New-VBOOffice365ApplicationOnlyConnectionSettings and Add-VBOOrganization have to be used.
That's my script
Code: Select all
$securepassword = Read-Host "Enter your password" -AsSecureString
$appid = Read-Host "Enter the copied application id"
$appSettings = New-VBOOffice365ApplicationOnlyConnectionSettings -ApplicationCertificatePath "C:\Temp\cert.pfx" -ApplicationCertificatePassword $securepassword -ApplicationId $appid -ConfigureApplication
Add-VBOOrganization -Office365ExchangeConnectionsSettings $appSettings -Office365SharePointConnectionsSettings $appSettings -EnableTeamsChats
What's not on my mind is where the certificate has to come from? The AAD application was already created and there is no possibility to create a certificate. And vice versa I didn't find any cmdlet to create a self-signed certificate as I can do using the wizard. From that point it is understandable that no cert.pfx can be found in the specified path.
Does anyone have a hint for me?
Thank you,
Chris
chrisflyckelen
Service Provider
Posts: 80 Liked: 11 times
Joined: Oct 15, 2019 7:51 am
Full Name: Christian van Eickelen
Contact:
Post
by chrisflyckelen » Nov 28, 2022 8:38 pm
2 people like this post
Okay, I just solved the issue by myself.
I created a self-signed certificate upfront on the VBO365 machine using this command:
Code: Select all
certname = "Test1234"
$cert = New-SelfSignedCertificate -Subject "CN=$certname" -CertStoreLocation "Cert:\CurrentUser\My" -KeyExportPolicy Exportable -KeySpec Signature -KeyLength 2048 -KeyAlgorithm RSA -HashAlgorithm SHA256
$mypwd = ConvertTo-SecureString -String "{myPassword}" -Force -AsPlainText ## Replace {myPassword}
Export-PfxCertificate -Cert $cert -FilePath "C:\Users\admin\Desktop\$certname.pfx" -Password $mypwd ## Specify your preferred location
So, if anyone else run into this... here is a solution.
Greets,
Chris
Mike Resseler
Product Manager
Posts: 8279 Liked: 1359 times
Joined: Feb 08, 2013 3:08 pm
Full Name: Mike Resseler
Location: Belgium
Contact:
Post
by Mike Resseler » Nov 29, 2022 8:12 am
this post
I love it when people solve their own issues
All jokes aside, thanks for posting the resolution also. You probably will help people in the future with it