Maintain control of your Microsoft 365 data
Post Reply
chrisflyckelen
Service Provider
Posts: 64
Liked: 8 times
Joined: Oct 15, 2019 7:51 am
Contact:

How to add an organization to VBO365 by PowerShell

Post by chrisflyckelen »

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: 64
Liked: 8 times
Joined: Oct 15, 2019 7:51 am
Contact:

Re: How to add an organization to VBO365 by PowerShell

Post by chrisflyckelen » 2 people like this post

Okay, I just solved the issue by myself. :D

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: 8191
Liked: 1322 times
Joined: Feb 08, 2013 3:08 pm
Full Name: Mike Resseler
Location: Belgium
Contact:

Re: How to add an organization to VBO365 by PowerShell

Post by Mike Resseler »

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 :-)
Post Reply

Who is online

Users browsing this forum: Mildur and 30 guests