Hi @Vel ,
I have reviewed your requirement and I did a POC in my lab environment to assign role to an Azure AD user by creating a deployment script.
You can first create a user assigned managed identity.
Then assign the role in Azure AD to this managed identity using the object id of the managed identity by creating a Deployment script.
Then run the Deployment script via Powershell.
Please refer to my lab my here : DeploymentScripts-GitHub-sreeja8
RoleAssignmentCreate.json - Assigns role to a Resource Group scope to a Azure AD user by dynamically fetching(using deployment script) the Principal ID with display name of the user.
Parameters.json - Contains parameters.
New-AzResourceGroupDeployment -ResourceGroupName lab -TemplateFile RoleAssignmentCreate.json -TemplateParameterFile Parameters.json -Name TestDeployment1
Below is the snippet of code from RoleAssignmentCreate.json file where we are working with the output from a Powershell script.
Reference link : deployment-script-template-output-from-powershell-script
Please "**Accept as answer" if this helps you. This will help us and others in the community as well.**