Functions/Disconnect-AzureRMS.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<#
.SYNOPSIS
    This function closes a connection to Azure RMS
#>

function Disconnect-AzureRMS {
    [CmdletBinding()]
    [OutputType([Bool])]
    param ()

    # Disconnect from Azure RMS
    try {
        Write-Information "Disconnecting from Azure RMS."
        Disconnect-AadrmService | Out-Null
        return $true
    }
    catch {
        Write-Error "Exception occurred while disconnecting from Azure RMS.`r`n$($_.Exception.Message)"
        return $false
    }
}