How To: Reset Domain TLS Certificate using PowerShell API
Question
How do I reset the TLS certificate for a domain using the PowerShell API?
Answer
You can reset the domain TLS certificate via the PowerShell API by executing the appropriate command that targets the domain object and triggers a certificate renewal or reissue.
Pre-requisites
Titan Api Enabled - How To: Use Titan API
Steps
$loginResponse = Invoke-Login -username admin -password mypass -AdminUrl localhost:31443
$loginResponse.Result | Format-List
$dom = Get-DomList -AdminUrl localhost:31443
$dom.Response.DomainList
$domparam = Get-DomParam -AdminUrl localhost:31443 -DomainGuid 4fe58d04-8c68-4b57-a3b4-8953fb2dd147
$domparam.Response | Format-List
$adminUrl = "localhost:31443"
$domainGuid = "4fe58d04-8c68-4b57-a3b4-8953fb2dd147"
$certGuidToRemove = "db2112ad-0000-0000-0000-100000000001"
# Check current assignments
$domain = Get-DomParam -AdminUrl $adminUrl -DomainGuid $domainGuid
# Remove assignment if it's currently used
if ($domain.Response.TlsLasCertGuid -eq $certGuidToRemove) {
$if1 = Set-DomParam -AdminUrl $adminUrl `
-InputObject ([Titan.API.Models.TitanApiIdentity]@{DomainGuid=$domainGuid}) `
-TlsLasCertGuid $null `
-Confirm:$false
$if1.Response.tls
}
if ($domain.Response.TlsRasCertGuid -eq $certGuidToRemove) {
$if2 = Set-DomParam -AdminUrl $adminUrl `
-InputObject ([Titan.API.Models.TitanApiIdentity]@{DomainGuid=$domainGuid}) `
-TlsRasCertGuid $null `
-Confirm:$false
$if2.Response
}
$domparam = Get-DomParam -AdminUrl localhost:31443 -DomainGuid 4fe58d04-8c68-4b57-a3b4-8953fb2dd147
$domparam.Response.TlsLasCertGuid