Wait for Connect?

If I run the Connect-AzureAd command below and close out of the browser tab, I get an error stating “User canceled authentication.”. If I run the Connect-PartnerCenter command, it launches a little differently. If I close out of the tab that it opens, nothing ever tells my app that someone canceled authentication. If I complete authentication, I do see a Success message.

How can I attach to the Connect-PartnerCenter process that is launched to see when someone closes out of the browser tab?

if (Connect-AzureAd) { write-host "Success" } else { write-host "Failure" }

if (Connect-PartnerCenter) { write-host "Success" } else { write-host "Failure" }

Any guidance would be greatly appreciated.