Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update-EntraUserFromFederated's -NewPassword parameter expects a string value #1360

Open
alexandair opened this issue Feb 14, 2025 · 3 comments
Labels

Comments

@alexandair
Copy link
Collaborator

Update-EntraUserFromFederated's -NewPassword parameter expects a string value instead of a securestring value.

The same applies to Update-EntraBetaUserFromFederated.

@MartinM85
Copy link

Probably also New-EntraUser and PasswordProfile parameter

@SamErde
Copy link
Collaborator

SamErde commented Feb 15, 2025

Probably also New-EntraUser and PasswordProfile parameter

This one is interesting because it uses a different type entirely. I don't know if PasswordProfile handles its members as a secure string or not.

[Parameter(ParameterSetName = "InvokeByDynamicParameters", Mandatory = $true)]
[Microsoft.Open.AzureAD.Model.PasswordProfile] $PasswordProfile,

#

if($null -ne $PSBoundParameters["PasswordProfile"])
        {
            $TmpValue = $PSBoundParameters["PasswordProfile"]
            $Value = @{
                forceChangePasswordNextSignIn = $TmpValue.ForceChangePasswordNextLogin
                forceChangePasswordNextSignInWithMfa = $TmpValue.EnforceChangePasswordPolicy
                password = $TmpValue.Password 
            }
            $params["passwordProfile"] = $Value
        }

#

        Write-Debug("============================ TRANSFORMATIONS ============================")
        $params.Keys | ForEach-Object {"$_ : $($params[$_])" } | Write-Debug
        Write-Debug("=========================================================================`n")
        $params = $params | ConvertTo-Json
        $response = Invoke-GraphRequest -Headers $customHeaders -Uri 'https://graph.microsoft.com/v1.0/users?$select=*' -Method POST -Body $params

So we may also want to think about redacting the password from the debug output in any functions that process passwords. @SteveMutungi254

@alexandair
Copy link
Collaborator Author

@SamErde @stevemutungi
I didn't mention this command because it has more issues.
I don't understand why old, AzureAD-based type, Microsoft.Open.AzureAD.Model.PasswordProfile, is used here. MSGraph-related PasswordProfile has different properties. So, we have unnecessary renaming in a function definition.

And, Password property is also string here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants