Hi @Nerin Peter Chetty (For Azure)
This is because your app is registered to authenticate users only with user flows/custom policies. You should create a single-tenant application to call the graph API:
Next, you'll be able to grant Directory.AccessAsUser.All
delegated permissions to your app, then use the Azure AD-based delegated authentication flow (i.e. auth code flow or ROPC flow) to get an access token and call the graph API to change the user's password.
Note that if you want to change passwords for other users in your tenant, you need to have at least the User Administrator role.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".