Skip to content

{Compute} az vm/vmss create: Support Ephemeral OS disk with full caching with --ephemeral-os-disk-enable-full-caching#33292

Open
william051200 wants to merge 18 commits intoAzure:devfrom
william051200:32351-full-caching
Open

{Compute} az vm/vmss create: Support Ephemeral OS disk with full caching with --ephemeral-os-disk-enable-full-caching#33292
william051200 wants to merge 18 commits intoAzure:devfrom
william051200:32351-full-caching

Conversation

@william051200
Copy link
Copy Markdown
Member

@william051200 william051200 commented Apr 30, 2026

Let's merge PR first before merging this PR

Related command

az vm create
az vm show
az vmss create
az vmss show

Description

Resolve #32351

aaz Azure/aaz#995

Additional: fix a bug in set_vmss_diagnostics_extension function under src/azure-cli/azure/cli/command_modules/vm/custom.py

Testing Guide

Refer to vm\tests\latest\test_vm_commands.py - test_vm_vmss_ephemeral_os_disk_full_caching

History Notes

[Compute] az vm/vmss create: Support Ephemeral OS disk with full caching with --ephemeral-os-disk-enable-full-caching


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

Copilot AI review requested due to automatic review settings April 30, 2026 00:41
@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd Bot commented Apr 30, 2026

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

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

azure-client-tools-bot-prd Bot commented Apr 30, 2026

⚠️AzureCLI-BreakingChangeTest
⚠️vm
rule cmd_name rule_message suggest_message
⚠️ 1006 - ParaAdd vm create cmd vm create added parameter ephemeral_os_disk_enable_full_caching
⚠️ 1006 - ParaAdd vmss create cmd vmss create added parameter ephemeral_os_disk_enable_full_caching

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented Apr 30, 2026

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions
Copy link
Copy Markdown

The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR.

Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds Azure CLI support for enabling ephemeral OS disk full caching during VM/VMSS creation, and updates the VM/VMSS AAZ command schemas to a newer Compute API version so the new enableFullCaching field can be surfaced in show/wait output.

Changes:

  • Introduces --ephemeral-os-disk-enable-full-caching (with alias) for az vm create / az vmss create and plumbs it into diffDiskSettings.enableFullCaching.
  • Updates AAZ-generated VM/VMSS create/show/update/wait schemas to Compute API 2025-11-01, including read/write schema for enableFullCaching.
  • Adds a scenario test validating enableFullCaching for both VM and VMSS.

Reviewed changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py Adds live scenario coverage for VM/VMSS create with full caching enabled and validates enableFullCaching in show output.
src/azure-cli/azure/cli/command_modules/vm/custom.py Updates create_vm/create_vmss function signatures to accept the new argument.
src/azure-cli/azure/cli/command_modules/vm/_params.py Adds the new CLI argument/aliases for VM/VMSS create.
src/azure-cli/azure/cli/command_modules/vm/_validators.py Passes the new argument into storage profile normalization.
src/azure-cli/azure/cli/command_modules/vm/_vm_utils.py Writes diffDiskSettings.enableFullCaching into the normalized disk info for ephemeral OS disk.
src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vm/_create.py Bumps API version and updates AAZ schema to include enableFullCaching support (plus other generated fields).
src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vm/_show.py Bumps API version and updates output schema to include enableFullCaching (plus other generated fields).
src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vm/_update.py Bumps API version and schema to include enableFullCaching (plus other generated fields).
src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vm/_wait.py Bumps API version and schema to include enableFullCaching (plus other generated fields).
src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vmss/_create.py Bumps API version and schema to include enableFullCaching (plus other generated fields/args).
src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vmss/_show.py Bumps API version and output schema to include enableFullCaching (plus other generated fields).
src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vmss/_update.py Bumps API version and schema to include enableFullCaching (plus other generated fields/args).
src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vmss/_wait.py Bumps API version and schema to include enableFullCaching (plus other generated fields).
src/azure-cli/azure/cli/command_modules/vm/aaz/latest/sig/identity/init.py Exposes the generated sig identity wait command via __init__.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

diff_disk_settings = cls._args_schema.virtual_machine_profile.storage_profile.os_disk.diff_disk_settings
diff_disk_settings.enable_full_caching = AAZBoolArg(
options=["enable-full-caching"],
help="Specifies whether or not to enable full caching for this VM which will cache the OS disk locally on the host and make this VM more resilient to storage outages",
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

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

This help string is in the VMSS command but says "enable full caching for this VM". Please update it to refer to the scale set (VMSS) to avoid confusing users (and ideally end the sentence with a period for consistency with other help text).

Suggested change
help="Specifies whether or not to enable full caching for this VM which will cache the OS disk locally on the host and make this VM more resilient to storage outages",
help="Specifies whether or not to enable full caching for this scale set, which will cache the OS disk locally on the host and make the scale set more resilient to storage outages.",

Copilot uses AI. Check for mistakes.
if ephemeral_os_disk_placement:
info['os']['diffDiskSettings']['placement'] = ephemeral_os_disk_placement
if ephemeral_os_disk_enable_full_caching is not None:
info['os']['diffDiskSettings']['enableFullCaching'] = ephemeral_os_disk_enable_full_caching
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

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

enableFullCaching appears to require Compute API version 2025-11-01 (per issue/spec), but the ARM template builder still uses apiVersion: 2025-04-01 for Microsoft.Compute/virtualMachines and virtualMachineScaleSets. As-is, adding diffDiskSettings.enableFullCaching here is likely to be rejected during template deployment. Please update the template resource apiVersion(s) to 2025-11-01 (or conditionally bump when this flag is set) so VM/VMSS create actually works.

Suggested change
info['os']['diffDiskSettings']['enableFullCaching'] = ephemeral_os_disk_enable_full_caching
raise CLIError(
'--ephemeral-os-disk-enable-full-caching requires the ARM template '
'resource apiVersion for Microsoft.Compute/virtualMachines and '
'Microsoft.Compute/virtualMachineScaleSets to be 2025-11-01 or later. '
'Update the template resource apiVersion before enabling this property.'
)

Copilot uses AI. Check for mistakes.
Comment on lines +1203 to +1205
c.argument('ephemeral_os_disk_enable_full_caching', arg_type=get_three_state_flag(),
options_list=['--ephemeral-os-disk-enable-full-caching', '--ephemeral-full-caching'],
help='Specifies whether or not to enable full caching for this VMSS which will cache the OS disk locally on the host and make this VMSS more resilient to storage outages')
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

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

This new argument is available for both vm create and vmss create, but (1) it is missing a min_api gate even though the feature requires 2025-11-01, and (2) the help text says "this VMSS" even when used with az vm create. Please add an appropriate min_api (likely 2025-11-01) and adjust the help to refer to "VM/VMSS" (or "VM or VMSS").

Suggested change
c.argument('ephemeral_os_disk_enable_full_caching', arg_type=get_three_state_flag(),
options_list=['--ephemeral-os-disk-enable-full-caching', '--ephemeral-full-caching'],
help='Specifies whether or not to enable full caching for this VMSS which will cache the OS disk locally on the host and make this VMSS more resilient to storage outages')
c.argument('ephemeral_os_disk_enable_full_caching', arg_type=get_three_state_flag(), min_api='2025-11-01',
options_list=['--ephemeral-os-disk-enable-full-caching', '--ephemeral-full-caching'],
help='Specifies whether or not to enable full caching for this VM/VMSS, which will cache the OS disk locally on the host and make the VM/VMSS more resilient to storage outages')

Copilot uses AI. Check for mistakes.
Comment on lines 18 to 22
_aaz_info = {
"version": "2025-04-01",
"version": "2025-11-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets/{}", "2025-04-01"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets/{}", "2025-11-01"],
]
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

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

The PR title/description is scoped to ephemeral OS disk full caching, but this file also bumps the VMSS API version to 2025-11-01 and introduces multiple new public CLI arguments (e.g., --external-health-policy, --lifecycle-hooks-profile, operation recovery settings, additional enum values). Please confirm these extra surface-area changes are intentional; if so, update the PR description/history notes accordingly or split them into a separate PR to keep review and release notes accurate.

Copilot uses AI. Check for mistakes.
diff_disk_settings = cls._args_schema.virtual_machine_profile.storage_profile.os_disk.diff_disk_settings
diff_disk_settings.enable_full_caching = AAZBoolArg(
options=["enable-full-caching"],
help="Specifies whether or not to enable full caching for this VM which will cache the OS disk locally on the host and make this VM more resilient to storage outages",
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

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

This help string is in the VMSS command but says "enable full caching for this VM". Please update it to refer to the scale set (VMSS) to avoid confusing users (and ideally end the sentence with a period for consistency with other help text).

Suggested change
help="Specifies whether or not to enable full caching for this VM which will cache the OS disk locally on the host and make this VM more resilient to storage outages",
help="Specifies whether or not to enable full caching for this scale set, which will cache the OS disk locally on the host and make this scale set more resilient to storage outages.",

Copilot uses AI. Check for mistakes.
@yanzhudd yanzhudd changed the title {Compute} az vm/ vmss create: Support Ephemeral OS disk with full caching with --ephemeral-os-disk-enable-full-caching {Compute} az vm/vmss create: Support Ephemeral OS disk with full caching with --ephemeral-os-disk-enable-full-caching May 8, 2026
@yanzhudd
Copy link
Copy Markdown
Contributor

yanzhudd commented May 8, 2026

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

arg_group="Properties",
help="When Overprovision is enabled, extensions are launched only on the requested number of VMs which are finally kept. This property will hence ensure that the extensions do not run on the extra overprovisioned VMs.",
)
_args_schema.external_health_policy = AAZObjectArg(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we need to update the function of converting camelcase to snake case accordingly?

help='Only applicable when used with `--ephemeral-os-disk`. Allows you to choose the Ephemeral OS disk provisioning location.')
c.argument('ephemeral_os_disk_enable_full_caching', arg_type=get_three_state_flag(),
options_list=['--ephemeral-os-disk-enable-full-caching', '--ephemeral-full-caching'],
help='Specifies whether or not to enable full caching for this VM/VMSS which will cache the OS disk locally on the host and make this VM/VMSS more resilient to storage outages')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
help='Specifies whether or not to enable full caching for this VM/VMSS which will cache the OS disk locally on the host and make this VM/VMSS more resilient to storage outages')
help='Specify whether or not to enable full caching for this VM/VMSS which will cache the OS disk locally on the host and make this VM/VMSS more resilient to storage outages')

external_health_policy.pop("gracePeriod")

lifecycle_hooks_profile = new_result.get("lifecycle_hooks_profile", {}) or {}
lifecycle_hooks = lifecycle_hooks_profile.get("lifecycleHooks", [])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

where do you add a new key lifecycle_hooks to replace this property?

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.

I have added it in the latest commit. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

act-observability-squad Auto-Assign Auto assign by bot Compute az vm/vmss/image/disk/snapshot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AzCLI support for Ephemeral OS disk with full caching during VM/VMSS create/update

5 participants