Hi All,
I have a dashboard that I believe was working in the past, connecting to both AzureAD and Exchange Online. Now it doesn’t seem to be connecting, and I’m not getting any output.
I’ve made a basic dashboard for troubleshooting, with POSHUD: Connect-AzureAD -Credential $AdminCredential
it fails to connect, but connecting with Connect-ExchangeOnline -Credential $AdminCredential
it succeeds. Both work when using standard powershell.
If it is working, it should log:
ExchangeOnline Connected
AzureAD Connected
To C:\temp\log$date.txt
I’m using Powershell Universal 2.1.2, and my environment is listed as:
5.1.14393.3866 C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
New-UDDashboard -Title "Testing Primary Offboarding" -Content {
$global:date = Get-Date -Format MM-yy
New-UDForm -Content {
New-UDTextbox -Id 'Execute' -Label 'Execute'
} -OnSubmit {
# Hard-coded credentials
$username = "<username>"
$password = "<password>"
$secureStringPwd = $password | ConvertTo-SecureString -AsPlainText -Force
$AdminCredential = New-Object System.Management.Automation.PSCredential -ArgumentList $username, $secureStringPwd
Start-Transcript -path "C:\temp\log$date.txt"
# Authenticating to services
Connect-ExchangeOnline -Credential $AdminCredential
Connect-AzureAD -Credential $AdminCredential
#Test ExchangeOnline Connection
#Provided that you have rules on your mailbox
$test = Get-InboxRule -Mailbox $username
if($test -eq $null){
write-host "ExchangeOnline not connected"
}
if($test -ne $null){
write-host "ExchangeOnline Connected"
}
#Check AzureAD Connection
if($azureConnection.Account -eq $null){
write-host "AzureAD not connected"
}
if($azureConnection.Account -ne $null){
write-host "AzureAD Connected"
}
Stop-Transcript
Get-PSSession | Remove-PSSession
}
}
Cheers
Sam