Public/Register-SCEPmanCertMaster.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
<#
.Synopsis Registers SCEPman CertMaster Azure AD application. .Parameter CertMasterBaseURL The base URL of the CertMaster Azure Web App .Parameter AzureADAppNameForCertMaster Name of the Azure AD app registration for SCEPman Certificate Master. Leave empty to use default name 'SCEPman-CertMaster' .Example # Registers SCEPman CertMaster Azure AD application where the CertMaster Azure Web App's base URL is 'https://scepman-cm.azurewebsites.net' Register-SCEPmanCertMaster 'https://scepman-cm.azurewebsites.net' .Example # Registers SCEPman CertMaster Azure AD application where the CertMaster Azure Web App's base URL is 'https://scepman-cm.azurewebsites.net' with the display name 'SCEPman-CertMasterApp' Register-SCEPmanCertMaster 'https://scepman-cm.azurewebsites.net' -AzureADAppNameForCertMaster 'SCEPman-CertMasterApp' #> function Register-SCEPmanCertMaster { [CmdletBinding()] param( [Parameter(Mandatory=$true)]$CertMasterBaseURL, $AzureADAppNameForCertMaster = 'SCEPman-CertMaster' ) Write-Information "Logging in to az" $CurrentAccount = AzLogin $appregcm = CreateCertMasterAppRegistration -AzureADAppNameForCertMaster $AzureADAppNameForCertMaster -CertMasterBaseURL $CertMasterBaseURL if($null -eq $appregcm) { Write-Error "We are unable to register the CertMaster app with the URL '$CertMasterBaseURL'" throw "We are unable to register the CertMaster app with the URL '$CertMasterBaseURL'" } else { Write-Information "SCEPman CertMaster app registration completed with id '$($appregcm.appId)' in the tenant '$($CurrentAccount.homeTenantId)'" } } |