Quantcast
Channel: R&D Forums
Viewing all articles
Browse latest Browse all 9994

Veeam Backup for Microsoft 365 • Re: Add organization with Teams chats enabled using PowerShell

$
0
0
Hi Christian

Why are you not just using the value of the property "AppID"? I don't understand the part where you try to convert the AppID ([System.Guid]$AzADApp).

This works for me:

Code:

Import-Module "C:\Program Files\Veeam\Backup365\Veeam.Archiver.PowerShell\Veeam.Archiver.PowerShell.psd1"$debnr = Read-Host "Enter customer's debtor no (ktxxxxxxxx)" $securepassword = Read-Host "Enter your password" -AsSecureString$certname = "CRT-$debnr-pcoM365BaaS"#Upfront creation an AzureAD applicationConnect-AzureADNew-AzureADApplication -DisplayName "pco-M365BaaS"$AzADApp = Get-AzureADApplication -SearchString "pco-M365BaaS" | Select-Object -ExpandProperty AppID#Creation of a new self-signed certificate$cert = New-SelfSignedCertificate -Subject "CN=$certname" -CertStoreLocation "Cert:\LocalMachine\My" -KeyExportPolicy Exportable -KeySpec Signature -KeyLength 2048 -KeyAlgorithm RSA -HashAlgorithm SHA256Export-PfxCertificate -Cert $cert -FilePath "C:\Certificates\$certname.pfx" -Password $securepassword  $newapp = New-VBOOffice365ApplicationOnlyConnectionSettings -ApplicationCertificatePath "C:\Certificates\$certname.pfx" -ApplicationCertificatePassword $securepassword -ApplicationId $AzADApp -ConfigureApplicationAdd-VBOOrganization -Office365ExchangeConnectionsSettings $newapp -Office365SharePointConnectionsSettings $newapp -EnableTeamsChats
Do you get an error message when running your code? Is it possible that your variable $AzADApp has more than one value? If you use -searchstring, you get all values starting with that string. Multiple values for the AppID are not allowed for New-VBOOffice365ApplicationOnlyConnectionSettings.

Image

Best,
Fabian

Update:
This code filters with where-object. It only selects one application where the display name matches the provided value:

Code:

Import-Module "C:\Program Files\Veeam\Backup365\Veeam.Archiver.PowerShell\Veeam.Archiver.PowerShell.psd1"$debnr = Read-Host "Enter customer's debtor no (ktxxxxxxxx)" $securepassword = Read-Host "Enter your password" -AsSecureString$certname = "CRT-$debnr-pcoM365BaaS"#Upfront creation an AzureAD applicationConnect-AzureADNew-AzureADApplication -DisplayName "pco-M365BaaS"$AzADApp = (Get-AzureADApplication | Where-Object {$_.DisplayName -eq "pco-M365BaaS"}).appid#Creation of a new self-signed certificate$cert = New-SelfSignedCertificate -Subject "CN=$certname" -CertStoreLocation "Cert:\LocalMachine\My" -KeyExportPolicy Exportable -KeySpec Signature -KeyLength 2048 -KeyAlgorithm RSA -HashAlgorithm SHA256Export-PfxCertificate -Cert $cert -FilePath "C:\Certificates\$certname.pfx" -Password $securepassword  $newapp = New-VBOOffice365ApplicationOnlyConnectionSettings -ApplicationCertificatePath "C:\Certificates\$certname.pfx" -ApplicationCertificatePassword $securepassword -ApplicationId $AzADApp -ConfigureApplicationAdd-VBOOrganization -Office365ExchangeConnectionsSettings $newapp -Office365SharePointConnectionsSettings $newapp -EnableTeamsChats

Statistics: Posted by Mildur — Jan 04, 2024 8:07 am



Viewing all articles
Browse latest Browse all 9994

Latest Images

Trending Articles



Latest Images