File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Setup Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -32,8 +32,14 @@ Function Invoke-ExecUpdateRefreshToken {
32
32
if ($env: TenantID -eq $Request.body.tenantId ) {
33
33
Set-AzKeyVaultSecret - VaultName $kv - Name ' RefreshToken' - SecretValue (ConvertTo-SecureString - String $Request.body.refreshtoken - AsPlainText - Force)
34
34
} else {
35
+ Write-Host " $ ( $env: TenantID ) does not match $ ( $Request.body.tenantId ) - we're adding a new secret for the tenant."
35
36
$name = $Request.body.tenantId -replace ' -' , ' _'
36
- Set-AzKeyVaultSecret - VaultName $kv - Name $name - SecretValue (ConvertTo-SecureString - String $Request.body.refreshtoken - AsPlainText - Force)
37
+ try {
38
+ Set-AzKeyVaultSecret - VaultName $kv - Name $name - SecretValue (ConvertTo-SecureString - String $Request.body.refreshtoken - AsPlainText - Force)
39
+ } catch {
40
+ Write-Host " Failed to set secret $name in KeyVault. $ ( $_.Exception.Message ) "
41
+ throw $_
42
+ }
37
43
}
38
44
}
39
45
$InstanceId = Start-UpdatePermissionsOrchestrator # start the CPV refresh immediately while wizard still runs.
You can’t perform that action at this time.
0 commit comments