AZURE

InvalidRequestContent - Invalid Request Content: Request Body Schema Violation

Your request body JSON doesn't match the resource schema for the API version you're using—properties might be missing, have wrong types, or violate enum constraints. This 400 client-side error occurs after ARM validates your JSON syntax but finds schema mismatches. Schema requirements vary by API version; what's optional in one version becomes required in another, or enum values change. ARM checks your request body against the resource type's schema definition. Affects VM creation, AKS cluster configuration, Azure SQL database setup, and App Service app settings.

#Common Causes

  • API Version Schema Drift: A property that was optional in an older API version becomes required in a newer one. Required properties vary by API version, so a request that worked with an older API version might fail with a newer one.
  • Invalid Enum Values: Property values don't match allowed enum values. Setting location to "East US" (with space) instead of "eastus" (lowercase, no space), or using a SKU that doesn't exist for that resource type, causes this.
  • Type Mismatch: A property has the wrong data type. A field expecting an integer but receiving a string, or an array where an object is expected, causes this.
  • Invalid Property Format: The value format is wrong (date format, GUID format, or string length exceeds limits). Limits and formats vary by property and aren't consistently documented.

Solutions

  1. 1Step 1: Diagnose - Review the error message for the specific field causing the problem. Use the field path (e.g., "properties.location") from the error message.
  2. 2Step 2: Diagnose - Check available API versions for your resource type: az provider show --namespace <provider-namespace> --query "resourceTypes[?resourceType=='<type>'].apiVersions" --output table
  3. 3Step 3: Diagnose - Get valid location names: az account list-locations --query "[].name" --output table
  4. 4Step 4: Fix - Validate ARM template before deployment: az deployment group validate --resource-group <rg> --template-file template.json --parameters @params.json
  5. 5Step 5: Fix - Ensure property names match the schema exactly (case-sensitive). Review the ARM REST API reference for your resource type and API version.
  6. 6Step 6: Fix - Use exact allowed enum values. For location: use lowercase with no spaces (e.g., "eastus" not "East US").
  7. 7Step 7: Fix - Convert values to the correct type. If a field expects an integer, ensure it's a number, not a string.
  8. 8Step 8: Verify - Retry your request. It should succeed with HTTP 200/201 instead of 400 InvalidRequestContent.

</>Code Examples

Request Schema Validation
1# This script helps diagnose InvalidRequestContent errors by validating request schema
2
3# Step 1: Get valid location names
4echo "Getting valid location names..."
5az account list-locations --query "[].{name:name, displayName:displayName}" --output table
6
7# Step 2: Check available API versions for a resource type (example: Virtual Machines)
8echo "Checking available API versions for Microsoft.Compute/virtualMachines..."
9az provider show --namespace Microsoft.Compute --query "resourceTypes[?resourceType=='virtualMachines'].apiVersions" --output table
10
11# Step 3: Validate ARM template (if using templates)
12RESOURCE_GROUP="my-resource-group"
13TEMPLATE_FILE="template.json"
14PARAMS_FILE="params.json"
15echo "Validating ARM template..."
16if [ -f "$TEMPLATE_FILE" ] && [ -f "$PARAMS_FILE" ]; then
17  az deployment group validate \
18    --resource-group $RESOURCE_GROUP \
19    --template-file $TEMPLATE_FILE \
20    --parameters @$PARAMS_FILE \
21    --output table
22else
23  echo "Template files not found. Skipping template validation."
24fi
25
26# Step 4: Check provider capabilities for a specific resource type
27echo "Checking provider capabilities..."
28az provider show --namespace Microsoft.Compute --query "resourceTypes[?resourceType=='virtualMachines']" --output table
29
30# Step 5: List available VM sizes in a region (example for VM creation)
31REGION="eastus"
32echo "Listing available VM sizes in region $REGION..."
33az vm list-sizes --location $REGION --output table
34
35# Step 6: Check valid SKU values (example: Storage account)
36echo "Valid Storage account SKU values:"
37echo "  - Standard_LRS"
38echo "  - Standard_GRS"
39echo "  - Standard_RAGRS"
40echo "  - Standard_ZRS"
41echo "  - Premium_LRS"
42
43# Step 7: Instructions for fixing common issues
44echo ""
45echo "Common fixes for InvalidRequestContent:"
46echo "  1. Check property names are case-sensitive (e.g., 'location' not 'Location')"
47echo "  2. Use valid enum values (e.g., 'eastus' not 'East US')"
48echo "  3. Ensure required properties are included for your API version"
49echo "  4. Convert types correctly (integers vs strings, arrays vs objects)"
50echo "  5. Validate date/GUID formats match schema requirements"

Related Errors

Provider Information

This error code is specific to AZURE services. For more information, refer to the official AZURE documentation.

InvalidRequestContent - Invalid Request Content: Request Body Schema Violation | AZURE Error Reference | Error Code Reference