Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{Identity} az identity: Upgrade api-version 2023-01-31 for managed identity #25418

Merged
merged 8 commits into from
Feb 16, 2023

Conversation

yanzhudd
Copy link
Contributor

@yanzhudd yanzhudd commented Feb 10, 2023

Related command

az identity

Description

MSI version 2023-01-31 is released.
Close: #25380

Testing Guide

History Notes

{Identity} az identity: Upgrade api-version 2023-01-31 of managed identity for commands except az identity list-resources


This checklist is used to make sure that common guidelines for a pull request are followed.

@ghost ghost requested a review from yonzhan February 10, 2023 07:05
@ghost ghost added the Auto-Assign Auto assign by bot label Feb 10, 2023
@ghost ghost requested a review from wangzelin007 February 10, 2023 07:05
@ghost ghost assigned zhoxing-ms Feb 10, 2023
@ghost ghost added this to the Feb 2023 (2023-03-07) milestone Feb 10, 2023
@ghost ghost added the Managed Identity For `az identity` only label Feb 10, 2023
@yanzhudd yanzhudd assigned yanzhudd and unassigned zhoxing-ms Feb 10, 2023
@yonzhan
Copy link
Collaborator

yonzhan commented Feb 10, 2023

Identity

@jiasli
Copy link
Member

jiasli commented Feb 14, 2023

The name "MSI" has been deprecated long ago. We should consider renaming it to "managed identity":

https://learn.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/overview

Managed identities for Azure resources is the new name for the service formerly known as Managed Service Identity (MSI).

@zhoxing-ms zhoxing-ms changed the title [Identity] az identity: Upgrade MSI version 2023-01-31 {Identity} az identity: Upgrade api-version 2023-01-31 for managed identity Feb 14, 2023
Comment on lines 13 to 14
def _msi_list_resources_client(cli_ctx, **_):
return _msi_client_factory(cli_ctx, api_version='2021-09-30-preview').user_assigned_identities
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a comment to explain why we need to specify the ad-hoc api-version

Copy link
Member

Choose a reason for hiding this comment

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

Ad-hoc API version can leads to scripts/trim_sdk.py script failure.

It should be declared at

AD_HOC_API_VERSIONS = {
ResourceType.MGMT_NETWORK: {
'appservice_network': '2020-04-01',
'appservice_ensure_subnet': '2019-02-01'
},
ResourceType.MGMT_CONTAINERREGISTRY: {
# src/azure-cli/azure/cli/command_modules/acr/_client_factory.py:8
'VERSION_2019_05_01_PREVIEW': "2019-05-01-preview",
'VERSION_2019_06_01_PREVIEW': "2019-06-01-preview",
'VERSION_2020_11_01_PREVIEW': "2020-11-01-preview",
'VERSION_2021_08_01_PREVIEW': "2021-08-01-preview",
'VERSION_2022_02_01_PREVIEW': "2022-02-01-preview",
},
ResourceType.MGMT_CONTAINERSERVICE: {
# src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_custom.py:50
'ManagedClusterAddonProfile': '2020-03-01',
}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @jiasli, declaration has been added here. Could you please review this change?



def _msi_list_resources_client(cli_ctx, **_):
return _msi_client_factory(cli_ctx, api_version='2021-09-30-preview').user_assigned_identities
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use the latest available api-version

Suggested change
return _msi_client_factory(cli_ctx, api_version='2021-09-30-preview').user_assigned_identities
return _msi_client_factory(cli_ctx, api_version='2022-01-31-preview').user_assigned_identities

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @isolenov,
we CLI use the api-version 2022-01-31-preview before upgrading and it supports listAssociatedResources command. Could you please help to confirm which version (2022-01-31-preview or 2021-09-30-preview) should be used for listAssociatedResources command?

Choose a reason for hiding this comment

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

@yanzhudd @zhoxing-ms please use latest preview version 2022-01-31-preview for listAssociatedResources

zhoxing-ms
zhoxing-ms previously approved these changes Feb 15, 2023
necusjz
necusjz previously approved these changes Feb 15, 2023
evelyn-ys
evelyn-ys previously approved these changes Feb 15, 2023
Copy link
Member

@jiasli jiasli left a comment

Choose a reason for hiding this comment

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

Ad-hoc API version should be forbidden unless declared.

@yanzhudd yanzhudd dismissed stale reviews from evelyn-ys, necusjz, and zhoxing-ms via 58ba8f4 February 15, 2023 09:25
@yanzhudd
Copy link
Contributor Author

Ad-hoc API version should be forbidden unless declared.

@jiasli Since there is a breaking change in the new version of MSI (a command is not supported), ad-hoc api version here is used for avoiding the breaking change. And we have discussed with the service team, and it seems this approach work the best.

The declaration for the ad-hoc api version is added, could you please help to review this change?

@yanzhudd yanzhudd merged commit cbb33a9 into Azure:dev Feb 16, 2023
@yanzhudd yanzhudd deleted the upgrade_msi_version branch February 16, 2023 06:47
avgale pushed a commit to avgale/azure-cli that referenced this pull request Aug 24, 2023
…identity (Azure#25418)

* upgrade msi version

* fix tests and support listAssociatedResources commands by using multi-api package

* fix tests and linter check

* reslove tests

* change api-version used for listAssociatedResources command from 2021-09-30-preview to 2022-01-31-preview

* fix credential scan

* fix credential scan

* add declaration for ad-hoc API version
Comment on lines +428 to +429
ResourceType.MGMT_MSI: {
'user_assigned_identities': '2022-01-31-preview',
Copy link
Member

Choose a reason for hiding this comment

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

It's recommended to add a comment showing where 2022-01-31-preview is used, like L425.

In this case, it'll be

        # src/azure-cli/azure/cli/command_modules/identity/_client_factory.py:18

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 Managed Identity For `az identity` only
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Release of MSI version 2023-01-31
7 participants