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
SetupNavContainer.ps1 Cannot bind parameter 'AccessToken'. Cannot convert the value of type "System.String" to type "System.Security.SecureString".
#206
In navcontainerhelper/AzureAD/New-AadAppsForBc.ps1 it tries to connect to MsGraph by using the accessToken but Connect-MgGraph -AccessToken requires a Secure String but $bcAuthContext.accessToken is a String:
# Connect to Microsoft.Graph
if (!$useCurrentMicrosoftGraphConnection) {
if ($bcAuthContext) {
$bcAuthContext = Renew-BcAuthContext -bcAuthContext $bcAuthContext
$jwtToken = Parse-JWTtoken -token $bcAuthContext.accessToken
if ($jwtToken.aud -ne 'https://graph.microsoft.com') {
Write-Host -ForegroundColor Yellow "The accesstoken was provided for $($jwtToken.aud), should have been for https://graph.microsoft.com"
}
Connect-MgGraph -AccessToken $bcAuthContext.accessToken | Out-Null
}
else {
if ($accessToken) {
Connect-MgGraph -accessToken $accessToken | Out-Null
}
else {
Connect-MgGraph -Scopes 'Application.ReadWrite.All' | Out-Null
}
}
}
As a workaround we resolved the issue for now and changed our local version of nav-arm-templates/master/SetupNavContainer.ps1 to connect first with MgGraph using the Secure String and using this connection via parameter -useCurrentMicrosoftGraphConnection instead of -bcAuthContext:
Hi,
When deploying Azure environments on basis of the nav-arm-templates we ran into an issue in nav-arm-templates/master/SetupNavContainer.ps1
The procedure that creates the Aad Apps for BC is raising the below error:
The procedure uses BcAuthContext to create the Aad Apps for BC in nav-arm-templates/master/SetupNavContainer.ps1:
In navcontainerhelper/AzureAD/New-AadAppsForBc.ps1 it tries to connect to MsGraph by using the accessToken but Connect-MgGraph -AccessToken requires a Secure String but $bcAuthContext.accessToken is a String:
As a workaround we resolved the issue for now and changed our local version of nav-arm-templates/master/SetupNavContainer.ps1 to connect first with MgGraph using the Secure String and using this connection via parameter -useCurrentMicrosoftGraphConnection instead of -bcAuthContext:
In this case its successfully creating the app registrations.
The text was updated successfully, but these errors were encountered: