diff --git a/src/azure-cli/azure/cli/command_modules/vm/_client_factory.py b/src/azure-cli/azure/cli/command_modules/vm/_client_factory.py index 9fe783b6de9..8c8ad624cac 100644 --- a/src/azure-cli/azure/cli/command_modules/vm/_client_factory.py +++ b/src/azure-cli/azure/cli/command_modules/vm/_client_factory.py @@ -67,10 +67,6 @@ def cf_rolling_upgrade_commands(cli_ctx, _): return _compute_client_factory(cli_ctx).virtual_machine_scale_set_rolling_upgrades -def cf_galleries(cli_ctx, _): - return _compute_client_factory(cli_ctx).galleries - - def cf_gallery_images(cli_ctx, _): return _compute_client_factory(cli_ctx).gallery_images diff --git a/src/azure-cli/azure/cli/command_modules/vm/_validators.py b/src/azure-cli/azure/cli/command_modules/vm/_validators.py index 602664133b6..67e92e0bf34 100644 --- a/src/azure-cli/azure/cli/command_modules/vm/_validators.py +++ b/src/azure-cli/azure/cli/command_modules/vm/_validators.py @@ -1411,6 +1411,15 @@ def _validate_vm_vmss_msi(cmd, namespace, is_identity_assign=False): _enable_msi_for_trusted_launch(namespace) +def process_sig_remove_identity_namespace(cmd, namespace): + if namespace.identities: + for i, identity in enumerate(namespace.identities): + namespace.identities[i] = _get_resource_id(cmd.cli_ctx, identity, + namespace.resource_group_name, + 'userAssignedIdentities', + 'Microsoft.ManagedIdentity') + + def _enable_msi_for_trusted_launch(namespace): # Enable system assigned msi by default when Trusted Launch configuration is met is_trusted_launch = namespace.security_type and namespace.security_type.lower() == 'trustedlaunch' \ diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/latest/sig/_create.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/latest/sig/_create.py index 3fe22ef3482..6f21530fcc1 100644 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/latest/sig/_create.py +++ b/src/azure-cli/azure/cli/command_modules/vm/aaz/latest/sig/_create.py @@ -19,12 +19,21 @@ class Create(AAZCommand): :example: Create a shared image gallery az sig create --resource-group MyResourceGroup --gallery-name MyGallery + + :example: Create a shared image gallery with enabled system assigned identity. + az sig create --resource-group MyResourceGroup --gallery-name MyGallery123 --system-assigned + + :example: Create a shared image gallery with a user assigned identity. + az sig create --resource-group MyResourceGroup --gallery-name MyGallery123 --user-assigned id1 + + :example: Create a shared image gallery with both system and user assigned identity. + az sig create --resource-group MyResourceGroup --gallery-name MyGallery123 --system-assigned --user-assigned id1 """ _aaz_info = { - "version": "2021-10-01", + "version": "2025-03-03", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/galleries/{}", "2021-10-01"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/galleries/{}", "2025-03-03"], ] } @@ -47,8 +56,11 @@ def _build_arguments_schema(cls, *args, **kwargs): _args_schema = cls._args_schema _args_schema.gallery_name = AAZStrArg( options=["-r", "--gallery-name"], - help="The name of the Shared Image Gallery to be deleted.", + help="The name of the Shared Image Gallery.", required=True, + fmt=AAZStrArgFormat( + pattern="^[^_\\W][\\w._-]{0,79}(?