You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Write-Information"Successfully set identifier URI on attempt $Attempt"
158
+
$IdentifierUriUpdated=$true
159
+
break
160
+
} catch {
161
+
$ErrorMsg=$_.Exception.Message
162
+
Write-Information"Identifier URI update attempt $Attempt failed: $ErrorMsg"
163
+
164
+
$IsNotReplicatedYet=$ErrorMsg-match"Resource '.*' does not exist or one of its queried reference-property objects are not present"
165
+
$IsConflict=$ErrorMsg-match"Another object with the same value for property identifierUris already exists"-or$ErrorMsg-match"Property identifierUris is invalid"
166
+
167
+
if ($IsConflict) {
168
+
Write-Warning"Identifier URI conflict detected: $ErrorMsg"
169
+
Write-Information"This may indicate the URI is already in use by another application or the app registration needs manual cleanup."
170
+
throw
144
171
}
145
-
continue
172
+
173
+
if ($IsNotReplicatedYet-and$Attempt-lt6) {
174
+
$DelaySeconds=3
175
+
Write-Information"Application object not yet replicated for identifier URI update (attempt $Attempt of 6). Retrying in $DelaySeconds second(s)."
Write-LogMessage-headers $Request.Headers-API 'ExecApiClient'-message "Repaired identifier URI for $($Client.AppName)$($RepairResult.Message)"-Sev 'Info'
244
+
$Results=@{
245
+
resultText="Identifier URI fixed for $($Client.AppName). $($RepairResult.Message)"
246
+
state='success'
247
+
}
248
+
} else {
249
+
$Results=@{
250
+
resultText="Identifier URI already correct for $($Client.AppName). $($RepairResult.Message)"
251
+
state='info'
252
+
}
253
+
}
254
+
} catch {
255
+
$ErrorMessage=Get-CippException-Exception $_
256
+
Write-LogMessage-headers $Request.Headers-API 'ExecApiClient'-message "Failed to repair identifier URI for $($Client.AppName)$($ErrorMessage.NormalizedError)"-Sev 'Error'-LogData $ErrorMessage
257
+
$Results=@{
258
+
resultText="Failed to repair identifier URI for $($Client.AppName)$($ErrorMessage.NormalizedError)"
0 commit comments