Adding the principal_name to the RoleAssignment class
Is your feature request related to a problem? Please describe.
A RoleAssignment class is missing the attribute principal_name. However, I can see the principal_name by using the Azure CLI:
az role assignment list
Describe the solution you'd like
Adding the principal_name attribute to the RoleAssignment.
Thanks for the feedback.
Could you provide the information: which SDK library are you using? the version of the library? if possible, some code snippet?
Thank you.
Hi @athiruma. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.
Package-details:- Name: azure-mgmt-authorization Version: 4.0.0
I am calling the role_assignment operations by following this doc. In which I used the list_for_scope method that returns the RoleAssignment object. In the role_assignment object, I do not see the principal_name.
My code snippet:
import json
from azure.mgmt.authorization import AuthorizationManagementClient
from cloud_governance.common.clouds.azure.common.common_operations import CommonOperations
class AuthorizationOperations(CommonOperations):
def __init__(self):
super().__init__()
self.__auth_client = AuthorizationManagementClient(credential=self._default_creds,
subscription_id=self._subscription_id)
def get_service_account_details(self):
"""
This method returns the service account details
:return:
:rtype:
"""
scope = f"/subscriptions/{self._subscription_id}"
role_assignments = self.__auth_client.role_assignments.list_for_scope(scope)
return self._item_paged_iterator(role_assignments, as_dict=True)
I guess to use the principal_id retuned should be enough though, and since there're serval principal types, the principal_name may not be able to have a stable format. But if you insist to request this feature, please know that Python SDK is generated with swagger automatically, so please open issue in https://github.com/Azure/azure-rest-api-specs/issues and mark it with label feature request. Once swagger is fixed, python SDK will release new version to support it.
Hi @athiruma. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.
In my use case, I needed the principal_name. Although I can find the principal_name using the principal_id with another SDK module, it would be beneficial if the principal_name could also be retrieved in the same place when listing roles. This request isn't beyond the scope, as the principal_name is displayed in the CLI command az ad list roles. I opened the feature_request, as you suggested.
got it, hope there will be a quick response
Closing the issue.
Please use https://github.com/Azure/azure-rest-api-specs/issues/28219 to track.