Skip to content

Commit

Permalink
Merge pull request microsoft#5139 from kasaxena5/AADApplicationKeyCre…
Browse files Browse the repository at this point in the history
…dentials

AAD Application Keycredentials
  • Loading branch information
NikCharlebois authored Oct 3, 2024
2 parents 1630144 + 9112965 commit 37c444b
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,16 @@ function Set-TargetResource

if($needToUpdateKeyCredentials -and $KeyCredentials)
{
Write-Warning -Message "KeyCredentials is a readonly property and cannot be configured."
Write-Verbose -Message "Updating for Azure AD Application {$($currentAADApp.DisplayName)} with KeyCredentials:`r`n$($KeyCredentials| Out-String)"

if((currentAADApp.KeyCredentials.Length -eq 0 -and $KeyCredentials.Length -eq 1) -or (currentAADApp.KeyCredentials.Length -eq 1 -and $KeyCredentials.Length -eq 0))
{
Update-MgApplication -ApplicationId $currentAADApp.Id -KeyCredentials $KeyCredentials | Out-Null
}
else
{
Write-Warning -Message "KeyCredentials cannot be updated for AAD Applications with more than one KeyCredentials due to technical limitation of Update-MgApplication Cmdlet. Learn more at: https://learn.microsoft.com/en-us/graph/api/application-addkey"
}
}
}

Expand Down

0 comments on commit 37c444b

Please sign in to comment.