Azure-cli: deployment valdiate doesn't validate properly.

Created on 21 Sep 2017  路  2Comments  路  Source: Azure/azure-cli

Description

When calling az group deployment validate g "test-01" --template-file .\azuredeploy.json --parameters .\azuredeploy-test-params.json, it returns no errors. When az group deployment create is called with the same parameters, it fails with InvalidRequestFormat.

Here is a subset of the template:

{
      "name": "pcf",
      "type": "Microsoft.Network/virtualNetworks",
      "apiVersion": "2017-03-01",
      "location": "[parameters('location')]",
      "tags": {
        "Environment": "[parameters('environment')]"
      },
      "properties": {
        "addressSpace": {
          "addressPrefixes": [
            "10.0.0.0/16"
          ]
        },
        "subnets": [
          {
            "name": "Management",
            "properties": {
              "addressPrefix": "10.0.4.0/22",
              "location": "[parameters('location')]",
              "tags": {
                "Environment": "[parameters('environment')]"
              },
              "properties": {
                "networkSecurityGroup": {
                  "securityRules": [
                    {
                      "properties": {
                        "description": "Allow Inbound HTTP/S",
                        "protocol": "*",
                        "sourcePortRange": "*",
                        "destinationPortRange": "80,443",
                        "sourceAddressPrefix": "*",
                        "destinationAddressPrefix": "*",
                        "access": "Allow",
                        "priority": 1400,
                        "direction": "Inbound"
                      },
                      "name": "Allow-Web"
                    }
                  ]
                }
              }
            }
          }
        ]
      }
    }

Here is an example of the failure:

Deployment failed. {
  "error": {
    "code": "InvalidRequestFormat",
    "message": "Cannot parse the request.",
    "details": [
      {
        "code": "InvalidJson",
        "message": "Could not find member 'location' on object of type 'SubnetProperties'. Path 'properties.subnets[0].properties.location', line 1, position 202."
      },
      {
        "code": "InvalidJson",
        "message": "Could not find member 'tags' on object of type 'SubnetProperties'. Path 'properties.subnets[0].properties.tags', line 1, position 218."
      },
      {
        "code": "InvalidJson",
        "message": "Could not find member 'properties' on object of type 'SubnetProperties'. Path 'properties.subnets[0].properties.properties', line 1, position 253."
      }
    ]
  }
}

Environment summary

Install Method: How did you install the CLI? (e.g. pip, interactive script, apt-get, Docker, MSI, nightly)
Answer here: MSI

CLI Version: What version of the CLI and modules are installed? (Use az --version)

PS C:\Users\MikeLloyd\Development\azure\pcf-azure-arm-templates> az --version
azure-cli (2.0.16)

acr (2.0.11)
acs (2.0.14)
appservice (0.1.15)
batch (3.1.2)
billing (0.1.4)
cdn (0.0.7)
cloud (2.0.7)
cognitiveservices (0.1.7)
command-modules-nspkg (2.0.1)
component (2.0.7)
configure (2.0.10)
consumption (0.1.4)
container (0.1.9)
core (2.0.15)
cosmosdb (0.1.12)
dla (0.0.11)
dls (0.0.13)
eventgrid (0.1.3)
feedback (2.0.6)
find (0.2.6)
interactive (0.3.9)
iot (0.1.11)
keyvault (2.0.9)
lab (0.0.10)
monitor (0.0.9)
network (2.0.13)
nspkg (3.0.1)
profile (2.0.11)
rdbms (0.0.6)
redis (0.2.8)
resource (2.0.13)
role (2.0.11)
servicefabric (0.0.3)
sf (1.0.8)
sql (2.0.10)
storage (2.0.14)
vm (2.0.13)

Python (Windows) 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 17:54:52) [MSC v.1900 32 bit (Intel)]

Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'

Legal docs and information: aka.ms/AzureCliLegal

OS Version: What OS and version are you using?
Answer here:
image

Shell Type: What shell are you using? (e.g. bash, cmd.exe, Bash on Windows)
Answer here:

PS C:\Users\MikeLloyd\Development\azure\pcf-azure-arm-templates> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.15063.608
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.15063.608
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
ARM Resource Manager-cli Service Attention

Most helpful comment

This will be addressed as part of the enhancement ARM team is making on the validate API

All 2 comments

This will be addressed as part of the enhancement ARM team is making on the validate API

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @armleads-azure

Was this page helpful?
0 / 5 - 0 ratings