def _get_id_from_value(permissions, value):
    """Get id from value for appRoles or oauth2PermissionScopes."""
    # https://docs.microsoft.com/en-us/graph/api/resources/serviceprincipal?view=graph-rest-1.0#properties
    return next(p['id'] for p in permissions if p['value'] == value)