See my Azure Portal. I'm looking to add the "Reader" role my service principal. How would I do this in Powershell?
You can make use of below PowerShell command to add Reader role to the service principal under subscription:
$spId = (Get-AzADServicePrincipal -DisplayName "sp_Name").id
$subscriptionId = "your_subscription_Id"
New-AzRoleAssignment -ObjectId $spId `
-RoleDefinitionName "Reader" `
-Scope "/subscriptions/$subscriptionId"
Response:
To confirm that, I checked the same in Portal where Reader
role added successfully to service principal under subscription level like this: