Skip to content

Conversation

@jiasli
Copy link
Member

@jiasli jiasli commented Jul 25, 2024

Related command
az role assignment list

Description
Close #27199

#29404 added deprecation message for --include-classic-administrators. This PR drops --include-classic-administrators argument.

Testing Guide

az role assignment list -h
az role assignment list --include-classic-administrators

@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Jul 25, 2024

️✔️AzureCLI-FullTest
️✔️acr
️✔️2020-09-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️acs
️✔️2020-09-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.9
️✔️ams
️✔️latest
️✔️3.12
️✔️3.9
️✔️apim
️✔️latest
️✔️3.12
️✔️3.9
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.9
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.9
️✔️aro
️✔️latest
️✔️3.12
️✔️3.9
️✔️backup
️✔️latest
️✔️3.12
️✔️3.9
️✔️batch
️✔️latest
️✔️3.12
️✔️3.9
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.9
️✔️billing
️✔️latest
️✔️3.12
️✔️3.9
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.9
️✔️cdn
️✔️latest
️✔️3.12
️✔️3.9
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.9
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.9
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.9
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.9
️✔️config
️✔️latest
️✔️3.12
️✔️3.9
️✔️configure
️✔️latest
️✔️3.12
️✔️3.9
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.9
️✔️container
️✔️latest
️✔️3.12
️✔️3.9
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.9
️✔️core
️✔️2018-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.9
️✔️databoxedge
️✔️2019-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️dls
️✔️latest
️✔️3.12
️✔️3.9
️✔️dms
️✔️latest
️✔️3.12
️✔️3.9
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.9
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.9
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.9
️✔️find
️✔️latest
️✔️3.12
️✔️3.9
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.9
️✔️identity
️✔️latest
️✔️3.12
️✔️3.9
️✔️iot
️✔️2019-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️keyvault
️✔️2018-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️lab
️✔️latest
️✔️3.12
️✔️3.9
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.9
️✔️maps
️✔️latest
️✔️3.12
️✔️3.9
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.9
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.9
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.9
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.9
️✔️network
️✔️2018-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.9
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.9
️✔️profile
️✔️latest
️✔️3.12
️✔️3.9
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.9
️✔️redis
️✔️latest
️✔️3.12
️✔️3.9
️✔️relay
️✔️latest
️✔️3.12
️✔️3.9
️✔️resource
️✔️2018-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️role
️✔️latest
️✔️3.12
️✔️3.9
️✔️search
️✔️latest
️✔️3.12
️✔️3.9
️✔️security
️✔️latest
️✔️3.12
️✔️3.9
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.9
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.9
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.9
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.9
️✔️sql
️✔️latest
️✔️3.12
️✔️3.9
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.9
️✔️storage
️✔️2018-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.9
️✔️telemetry
️✔️2018-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️util
️✔️latest
️✔️3.12
️✔️3.9
️✔️vm
️✔️2018-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9

@azure-client-tools-bot-prd
Copy link

Hi @jiasli,
Since the current milestone time is less than 7 days, this pr will be reviewed in the next milestone.

@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Jul 25, 2024

❌AzureCLI-BreakingChangeTest
❌role
rule cmd_name rule_message suggest_message
1007 - ParaRemove role assignment list cmd role assignment list removed parameter include_classic_administrators please add back parameter include_classic_administrators for cmd role assignment list

Please submit your Breaking Change Pre-announcement ASAP if you haven't already. Please note:

  • Breaking changes can only be merged during the designated breaking change window
  • A pre-announcement must be released at least one month in advance

For more details on how to introduce breaking changes, refer to the documentation: azure-cli/doc/how_to_introduce_breaking_changes.md

@yonzhan
Copy link
Collaborator

yonzhan commented Jul 25, 2024

BREAKING CHANGE

@microsoft-github-policy-service microsoft-github-policy-service bot added the Auto-Assign Auto assign by bot label Jul 25, 2024
@jiasli jiasli self-assigned this Jul 25, 2024
@jiasli
Copy link
Member Author

jiasli commented Jul 25, 2024

Sample classic admins returned by az role assignment list --include-classic-administrators:

  {
    "id": "NA(classic admins)",
    "name": "NA(classic admins)",
    "principalId": "00000000-0000-0000-0000-000000000000",
    "principalName": "[email protected]",
    "roleDefinitionId": "NA(classic admin role)",
    "roleDefinitionName": "ServiceAdministrator;AccountAdministrator",
    "scope": "/subscriptions/00000000-0000-0000-0000-000000000000"
  },
  {
    "id": "NA(classic admins)",
    "name": "NA(classic admins)",
    "principalId": "00000000-0000-0000-0000-000000000000",
    "principalName": "[email protected]",
    "roleDefinitionId": "NA(classic admin role)",
    "roleDefinitionName": "CoAdministrator",
    "scope": "/subscriptions/00000000-0000-0000-0000-000000000000"
  },

@jiasli jiasli marked this pull request as ready for review August 1, 2024 10:57

def _backfill_assignments_for_co_admins(cli_ctx, auth_client, assignee=None):
worker = MultiAPIAdaptor(cli_ctx)
co_admins = auth_client.classic_administrators.list() # known swagger bug on api-version handling
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know what the bug is.

@jiasli
Copy link
Member Author

jiasli commented Aug 8, 2024

According to https://learn.microsoft.com/en-us/azure/role-based-access-control/classic-administrators, the full deprecation of classic admins has been extended to April 3, 2024. Putting this PR into backlog.

ResourceType.MGMT_AUTHORIZATION: SDKProfile('2015-07-01', {
'classic_administrators': '2015-06-01'
}),
ResourceType.MGMT_AUTHORIZATION: '2015-07-01',
Copy link
Member Author

Choose a reason for hiding this comment

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

Changing ResourceType.MGMT_AUTHORIZATION's value from an SDKProfile to str causes test failure:

2025-04-22T10:21:46.6275851Z ________________ ProviderOperationTest.test_provider_operation _________________
2025-04-22T10:21:46.6276390Z [gw0] linux -- Python 3.12.10 /mnt/vss/_work/1/s/env/bin/python
2025-04-22T10:21:46.6276919Z self = <azure.cli.testsdk.base.ExecutionResult object at 0x7f482d0c7e00>
2025-04-22T10:21:46.6277448Z cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7f482d3db950>
2025-04-22T10:21:46.6277964Z command = 'provider operation show --namespace microsoft.compute'
2025-04-22T10:21:46.6278413Z expect_failure = False
2025-04-22T10:21:46.6278573Z 
2025-04-22T10:21:46.6278994Z     def _in_process_execute(self, cli_ctx, command, expect_failure=False):
2025-04-22T10:21:46.6279678Z         from io import StringIO
2025-04-22T10:21:46.6280135Z         from vcr.errors import CannotOverwriteExistingCassetteException
2025-04-22T10:21:46.6280535Z     
2025-04-22T10:21:46.6280866Z         if command.startswith('az '):
2025-04-22T10:21:46.6281239Z             command = command[3:]
2025-04-22T10:21:46.6281548Z     
2025-04-22T10:21:46.6281872Z         stdout_buf = StringIO()
2025-04-22T10:21:46.6282251Z         logging_buf = StringIO()
2025-04-22T10:21:46.6282888Z         try:
2025-04-22T10:21:46.6283343Z             # issue: stderr cannot be redirect in this form, as a result some failure information
2025-04-22T10:21:46.6283825Z             # is lost when command fails.
2025-04-22T10:21:46.6284306Z >           self.exit_code = cli_ctx.invoke(shlex.split(command), out_file=stdout_buf) or 0
2025-04-22T10:21:46.6284579Z 
2025-04-22T10:21:46.6284982Z src/azure-cli-testsdk/azure/cli/testsdk/base.py:303: 
2025-04-22T10:21:46.6285454Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
2025-04-22T10:21:46.6285970Z env/lib/python3.12/site-packages/knack/cli.py:245: in invoke
2025-04-22T10:21:46.6286424Z     exit_code = self.exception_handler(ex)
2025-04-22T10:21:46.6286887Z src/azure-cli-core/azure/cli/core/__init__.py:129: in exception_handler
2025-04-22T10:21:46.6287333Z     return handle_exception(ex)
2025-04-22T10:21:46.6287759Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
2025-04-22T10:21:46.6287970Z 
2025-04-22T10:21:46.6288418Z ex = AttributeError("'str' object has no attribute 'provider_operations_metadata'")
2025-04-22T10:21:46.6288895Z args = (), kwargs = {}
2025-04-22T10:21:46.6289040Z 
2025-04-22T10:21:46.6289482Z     def _handle_main_exception(ex, *args, **kwargs):  # pylint: disable=unused-argument
2025-04-22T10:21:46.6290041Z         if isinstance(ex, CannotOverwriteExistingCassetteException):
2025-04-22T10:21:46.6290590Z             # This exception usually caused by a no match HTTP request. This is a product error
2025-04-22T10:21:46.6290883Z             # that is caused by change of SDK invocation.
2025-04-22T10:21:46.6291103Z             raise ex
2025-04-22T10:21:46.6291270Z     
2025-04-22T10:21:46.6291457Z >       raise CliExecutionError(ex)
2025-04-22T10:21:46.6291773Z E       azure.cli.testsdk.exceptions.CliExecutionError: The CLI throws exception AttributeError during execution and fails the command.
2025-04-22T10:21:46.6291948Z 
2025-04-22T10:21:46.6292185Z src/azure-cli-testsdk/azure/cli/testsdk/patches.py:35: CliExecutionError
2025-04-22T10:21:46.6292628Z 
2025-04-22T10:21:46.6292873Z During handling of the above exception, another exception occurred:
2025-04-22T10:21:46.6293008Z 
2025-04-22T10:21:46.6293292Z self = <azure.cli.command_modules.resource.tests.hybrid_2018_03_01.test_resource.ProviderOperationTest testMethod=test_provider_operation>
2025-04-22T10:21:46.6293486Z 
2025-04-22T10:21:46.6293676Z     def test_provider_operation(self):
2025-04-22T10:21:46.6293929Z >       self.cmd('provider operation show --namespace microsoft.compute', checks=[
2025-04-22T10:21:46.6294242Z             self.check('id', '/providers/Microsoft.Authorization/providerOperations/Microsoft.Compute'),
2025-04-22T10:21:46.6294547Z             self.check('type', 'Microsoft.Authorization/providerOperations')
2025-04-22T10:21:46.6294762Z         ])
2025-04-22T10:21:46.6294826Z 
2025-04-22T10:21:46.6295082Z src/azure-cli/azure/cli/command_modules/resource/tests/hybrid_2018_03_01/test_resource.py:240: 
2025-04-22T10:21:46.6295362Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
2025-04-22T10:21:46.6295632Z src/azure-cli-testsdk/azure/cli/testsdk/base.py:177: in cmd
2025-04-22T10:21:46.6295927Z     return execute(self.cli_ctx, command, expect_failure=expect_failure).assert_with_checks(checks)
2025-04-22T10:21:46.6296247Z src/azure-cli-testsdk/azure/cli/testsdk/base.py:252: in __init__
2025-04-22T10:21:46.6296526Z     self._in_process_execute(cli_ctx, command, expect_failure=expect_failure)
2025-04-22T10:21:46.6296958Z src/azure-cli-testsdk/azure/cli/testsdk/base.py:315: in _in_process_execute
2025-04-22T10:21:46.6297195Z     raise ex.exception
2025-04-22T10:21:46.6297438Z env/lib/python3.12/site-packages/knack/cli.py:233: in invoke
2025-04-22T10:21:46.6297688Z     cmd_result = self.invocation.execute(args)
2025-04-22T10:21:46.6297943Z src/azure-cli-core/azure/cli/core/commands/__init__.py:666: in execute
2025-04-22T10:21:46.6298161Z     raise ex
2025-04-22T10:21:46.6298404Z src/azure-cli-core/azure/cli/core/commands/__init__.py:734: in _run_jobs_serially
2025-04-22T10:21:46.6298692Z     results.append(self._run_job(expanded_arg, cmd_copy))
2025-04-22T10:21:46.6298970Z src/azure-cli-core/azure/cli/core/commands/__init__.py:703: in _run_job
2025-04-22T10:21:46.6299211Z     result = cmd_copy(params)
2025-04-22T10:21:46.6299435Z src/azure-cli-core/azure/cli/core/commands/__init__.py:336: in __call__
2025-04-22T10:21:46.6299694Z     return self.handler(*args, **kwargs)
2025-04-22T10:21:46.6299957Z src/azure-cli-core/azure/cli/core/commands/command_operation.py:362: in handler
2025-04-22T10:21:46.6300236Z     show_exception_handler(ex)
2025-04-22T10:21:46.6300498Z src/azure-cli-core/azure/cli/core/commands/arm.py:432: in show_exception_handler
2025-04-22T10:21:46.6300728Z     raise ex
2025-04-22T10:21:46.6300960Z src/azure-cli-core/azure/cli/core/commands/command_operation.py:360: in handler
2025-04-22T10:21:46.6301226Z     return op(**command_args)
2025-04-22T10:21:46.6301443Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
2025-04-22T10:21:46.6301545Z 
2025-04-22T10:21:46.6301767Z cmd = <azure.cli.core.commands.AzCliCommand object at 0x7f482b5608f0>
2025-04-22T10:21:46.6302020Z resource_provider_namespace = 'microsoft.compute'
2025-04-22T10:21:46.6302127Z 
2025-04-22T10:21:46.6305438Z     def show_provider_operations(cmd, resource_provider_namespace):
2025-04-22T10:21:46.6305883Z >       version = getattr(get_api_version(cmd.cli_ctx, ResourceType.MGMT_AUTHORIZATION), 'provider_operations_metadata')
2025-04-22T10:21:46.6306240Z E       AttributeError: 'str' object has no attribute 'provider_operations_metadata'
2025-04-22T10:21:46.6306373Z 
2025-04-22T10:21:46.6306620Z src/azure-cli/azure/cli/command_modules/resource/custom.py:3124: AttributeError

This is because azure.cli.command_modules.resource.custom.show_provider_operations tries to get the API version of provider_operations_metadata to call Provider Operations Metadata - Get API:

version = getattr(get_api_version(cmd.cli_ctx, ResourceType.MGMT_AUTHORIZATION), 'provider_operations_metadata')

@jiasli jiasli merged commit 60c6ef9 into Azure:dev Apr 23, 2025
55 checks passed
@jiasli jiasli deleted the classic-admin branch April 23, 2025 09:34
@jiasli jiasli changed the title [BREAKING CHANGE] az role assignment list: Drop --include-classic-administrators argument [Role] BREAKING CHANGE: az role assignment list: Drop --include-classic-administrators argument May 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Auto-Assign Auto assign by bot RBAC az role

Projects

None yet

Development

Successfully merging this pull request may close these issues.

az role assignment list: Deprecate --include-classic-administrators argument

4 participants