Last active
December 31, 2023 16:10
-
-
Save FH-Inway/5b5e86a4eb7ee8cd1670c6a8599d8f1e to your computer and use it in GitHub Desktop.
Adds an Entra app registration id as audienceUri in a D365FO wif.config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adds an audienceUri entry to the WIF configuration file | |
# Original script: https://gist.github.com/FH-Inway/5b5e86a4eb7ee8cd1670c6a8599d8f1e | |
param( | |
[Parameter(Mandatory)] | |
[Alias('AppId', 'ClientId')] | |
[string]$AudienceUri, | |
[string]$WifConfigPath = 'K:\AosService\webroot\wif.config' | |
) | |
[xml]$wifConfig = Get-Content $WifConfigPath | |
$audienceUris = $wifConfig.'system.identityModel'.'identityConfiguration'.'securityTokenHandlers'.'securityTokenHandlerConfiguration'.'audienceUris' | |
$audienceUriElement = $wifConfig.CreateElement('add') | |
$audienceUriElement.SetAttribute('value', "spn:$AudienceUri") | |
$audienceUris.PrependChild($audienceUriElement) | |
$wifConfig.Save($WifConfigPath) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment