[Azure AI Search] az search service create --sku serverless always fails: CLI sends replicaCount/partitionCount which serverless rejects (HTTP 400)
Describe the bug
az search service create --sku serverless can never create a service. serverless is a valid value in the command's own --sku enum, but the command always emits an ARM PUT containing properties.replicaCount and properties.partitionCount (both defaulted to 1). The serverless SKU rejects replicaCount with HTTP 400, so the create fails every time and nothing is provisioned. There is no flag that suppresses those properties (you cannot pass a count of 0), so the failure is unconditional.
A hand-written ARM PUT, or a Bicep deployment, that omits those two properties creates the same serverless service successfully. That shows the fault is in the request body the CLI builds, not in the service.
Related command
az search service create
To Reproduce
Run the command with only the required arguments (no replica or partition flags):
az search service create -n <name> -g <rg> -l westcentralus --sku serverless
Actual behavior
The CLI builds and sends this ARM request:
PUT https://management.azure.com/subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.Search/searchServices/<name>?api-version=2026-03-01-preview
Content-Type: application/json
{
"location": "westcentralus",
"properties": {
"hostingMode": "default",
"partitionCount": 1,
"publicNetworkAccess": "enabled",
"replicaCount": 1
},
"sku": { "name": "serverless" }
}
partitionCount and replicaCount are injected by the CLI even though they were never supplied on the command line, and neither is valid for the serverless SKU. ARM returns 400 and no service is created:
{"error":{"code":"BadRequest","message":"The 'replicaCount' property is not applicable to the 'serverless' SKU."}}
Expected behavior
For the serverless SKU, the CLI should omit replicaCount, partitionCount, and hostingMode from the request body, matching what ARM and Bicep accept. The minimal request succeeds and the service provisions:
PUT .../searchServices/<name>?api-version=2026-03-01-preview
Content-Type: application/json
{ "location": "westcentralus", "sku": { "name": "serverless" } }
A service created this way returns replicaCount and partitionCount as null, which is the expected serverless shape.
Environment summary
- azure-cli 2.87.0
- OS: Windows
az search service create(GA)
Additional context
The create command is AAZ-generated and serializes both properties unconditionally from arguments that default to 1, in src/azure-cli/azure/cli/command_modules/search/aaz/latest/search/service/_create.py:
properties.set_prop("partitionCount", AAZIntType, ".partition_count")
properties.set_prop("replicaCount", AAZIntType, ".replica_count")
A serverless-aware fix would skip these properties (and hostingMode) when --sku serverless is used. Bicep already special-cases this.
Thank you for opening this issue, we will look into it.
Thanks for filling this - I’ll look into it
Fix is up in #33519.
A note on the root cause, because it turned out to be a bit more subtle than ""the CLI just builds the wrong body"":
serverlessis a validSkuNamein the spec, and there was already a test for it (test_service_create_supports_serverless_sku_argument). But that test only assertsserverlessis in the--skuenum — it never inspected the request body.- In the 2026-03-01-preview spec,
replicaCountandpartitionCountcarrydefault: 1and are described as applying to the dedicated search service;hostingModedefaults toDefault. Because the create command is AAZ-generated from that spec, those arguments default to1/defaultand are always serialized into the ARMPUT— exactly the body you captured. - When serverless support was first added, the service still accepted those extra properties, so creation succeeded end-to-end and the enum-only test passed. The body-construction problem stayed latent. It only surfaced as a hard
HTTP 400once the service tightened validation to rejectreplicaCount/partitionCountfor serverless. So at the time the feature shipped, neither client- nor server-side validation caught it.
The fix special-cases serverless in pre_operations to omit replicaCount, partitionCount and hostingMode (and to error clearly if you explicitly pass a non-default value for them with serverless). I also added offline regression tests that assert the actual serialized request body — so this can't silently regress again — and verified the other SKUs are unchanged.
Plus one; tested it yesterday via Az CLI and REST API calls, but the behavior is the same. Is there any planned ETA for when this will be resolved?