Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/azure-cli-core/azure/cli/core/profiles/_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,7 @@ def default_api_version(self):
ResourceType.MGMT_RESOURCE_MANAGEDAPPLICATIONS: '2019-07-01',
ResourceType.MGMT_NETWORK_PRIVATEDNS: None,
ResourceType.MGMT_KEYVAULT: None,
ResourceType.MGMT_AUTHORIZATION: SDKProfile('2022-04-01', {
'role_definitions': '2022-05-01-preview',
'provider_operations_metadata': '2018-01-01-preview'
}),
ResourceType.MGMT_AUTHORIZATION: None,
ResourceType.MGMT_CONTAINERREGISTRY: SDKProfile('2025-03-01-preview', {
'agent_pools': '2025-03-01-preview',
'tasks': '2025-03-01-preview',
Expand Down
26 changes: 6 additions & 20 deletions src/azure-cli/azure/cli/command_modules/acs/_roleassignments.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,21 +93,9 @@ def add_role_assignment_executor(cmd, role, assignee, resource_group_name=None,
mod="models",
operation_group="role_assignments",
)
if cmd.supported_api_version(min_api="2018-01-01-preview", resource_type=ResourceType.MGMT_AUTHORIZATION):
parameters = RoleAssignmentCreateParameters(role_definition_id=role_id, principal_id=object_id,
principal_type=assignee_principal_type)
return assignments_client.create(scope, assignment_name, parameters, headers=custom_headers)

# for backward compatibility
RoleAssignmentProperties = get_sdk(
cmd.cli_ctx,
ResourceType.MGMT_AUTHORIZATION,
"RoleAssignmentProperties",
mod="models",
operation_group="role_assignments",
)
properties = RoleAssignmentProperties(role_definition_id=role_id, principal_id=object_id)
return assignments_client.create(scope, assignment_name, properties, headers=custom_headers)
parameters = RoleAssignmentCreateParameters(role_definition_id=role_id, principal_id=object_id,
principal_type=assignee_principal_type)
return assignments_client.create(scope, assignment_name, parameters, headers=custom_headers)


def add_role_assignment(cmd, role, service_principal_msi_id, is_service_principal=True,
Expand Down Expand Up @@ -271,11 +259,9 @@ def delete_role_assignments_executor(
def subnet_role_assignment_exists(cmd, scope):
factory = get_auth_management_client(cmd.cli_ctx, scope)
assignments_client = factory.role_assignments

if cmd.supported_api_version(min_api='2018-01-01-preview', resource_type=ResourceType.MGMT_AUTHORIZATION):
for i in assignments_client.list_for_scope(scope=scope, filter='atScope()'):
if i.scope == scope and i.role_definition_id.endswith(CONST_NETWORK_CONTRIBUTOR_ROLE_ID):
return True
for i in assignments_client.list_for_scope(scope=scope, filter='atScope()'):
if i.scope == scope and i.role_definition_id.endswith(CONST_NETWORK_CONTRIBUTOR_ROLE_ID):
return True
return False


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,7 @@ interactions:
User-Agent:
- AZURECLI/2.65.0 azsdk-python-core/1.31.0 Python/3.11.9 (macOS-14.7-x86_64-i386-64bit)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_aro000001/providers/Microsoft.Network/virtualNetworks/dev-vnet/providers/Microsoft.Authorization/permissions?api-version=2015-07-01
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_aro000001/providers/Microsoft.Network/virtualNetworks/dev-vnet/providers/Microsoft.Authorization/permissions?api-version=2022-05-01-preview
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Live run this test azdev test --series --live test_aro_public_cluster fails:

        aad = AADManager(cmd.cli_ctx)

        rp_client_sp_id = aad.get_service_principal_id(resolve_rp_client_id())
        if not rp_client_sp_id:
>           raise ResourceNotFoundError("RP service principal not found.")
E           azure.cli.core.azclierror.ResourceNotFoundError: RP service principal not found.

src\azure-cli\azure\cli\command_modules\aro\custom.py:229: ResourceNotFoundError

response:
body:
string: '{"value":[{"actions":["*/read","Microsoft.Authorization/*","Microsoft.Support/*"],"notActions":[]},{"actions":["*"],"notActions":["Microsoft.Authorization/*/Delete","Microsoft.Authorization/*/Write","Microsoft.Authorization/elevateAccess/Action","Microsoft.Blueprint/blueprintAssignments/write","Microsoft.Blueprint/blueprintAssignments/delete","Microsoft.Compute/galleries/share/action","Microsoft.Purview/consents/write","Microsoft.Purview/consents/delete","Microsoft.Resources/deploymentStacks/manageDenySetting/action"]}]}'
Expand Down Expand Up @@ -2117,7 +2117,7 @@ interactions:
User-Agent:
- AZURECLI/2.65.0 azsdk-python-core/1.31.0 Python/3.11.9 (macOS-14.7-x86_64-i386-64bit)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_aro000001/providers/Microsoft.Network/virtualNetworks/dev-vnet/providers/Microsoft.Authorization/permissions?api-version=2015-07-01
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_aro000001/providers/Microsoft.Network/virtualNetworks/dev-vnet/providers/Microsoft.Authorization/permissions?api-version=2022-05-01-preview
response:
body:
string: '{"value":[{"actions":["*/read","Microsoft.Authorization/*","Microsoft.Support/*"],"notActions":[]},{"actions":["*"],"notActions":["Microsoft.Authorization/*/Delete","Microsoft.Authorization/*/Write","Microsoft.Authorization/elevateAccess/Action","Microsoft.Blueprint/blueprintAssignments/write","Microsoft.Blueprint/blueprintAssignments/delete","Microsoft.Compute/galleries/share/action","Microsoft.Purview/consents/write","Microsoft.Purview/consents/delete","Microsoft.Resources/deploymentStacks/manageDenySetting/action"]}]}'
Expand Down
3 changes: 0 additions & 3 deletions src/azure-cli/azure/cli/command_modules/resource/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -3119,10 +3119,7 @@ def list_provider_permissions(cmd, resource_provider_namespace):


def show_provider_operations(cmd, resource_provider_namespace):
version = getattr(get_api_version(cmd.cli_ctx, ResourceType.MGMT_AUTHORIZATION), 'provider_operations_metadata')
auth_client = _authorization_management_client(cmd.cli_ctx)
if version == '2015-07-01':
return auth_client.provider_operations_metadata.get(resource_provider_namespace, api_version=version)
return auth_client.provider_operations_metadata.get(resource_provider_namespace)


Expand Down
Loading
Loading