question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Invalid validation errors for Microsoft.Web/sites/config

See original GitHub issue

This was reported here: https://github.com/microsoft/vscode-azurearmtools/issues/1240

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {},
    "functions": [],
    "variables": {
        "ipSecurityRestrictions": [
        {
            "ipAddress": "127.0.0.1/32",
            "name": "No place like localhost"
        }],
        "scmIpSecurityRestrictions": [
        {
            "ipAddress": "127.0.0.1/32",
            "name": "No place like localhost"
        }]
    },
    "resources": [{
      "type": "Microsoft.Web/sites/config",
      "name": "test",
      "apiVersion": "2018-11-01",
      "location": "West Europe",
      "tags": {},
      "properties": {
        "numberOfWorkers": 1,
        "defaultDocuments": [
          "Default.htm",
          "Default.html",
          "Default.asp",
          "index.htm",
          "index.html",
          "iisstart.htm",
          "default.aspx",
          "index.php"
        ],
        "copy": [
          {
            "name": "ipSecurityRestrictions",
            "count": "[length(variables('ipSecurityRestrictions'))]",
            "input": {
              "ipAddress": "[variables('ipSecurityRestrictions')[copyIndex('ipSecurityRestrictions')].ipAddress]",
              "name": "[variables('ipSecurityRestrictions')[copyIndex('ipSecurityRestrictions')].name]",
              "priority": "[mul(add(copyIndex('ipSecurityRestrictions'), 1), 100)]"
            }
          },
          {
            "name": "scmIpSecurityRestrictions",
            "count": "[length(variables('scmIpSecurityRestrictions'))]",
            "input": {
              "ipAddress": "[variables('scmIpSecurityRestrictions')[copyIndex('scmIpSecurityRestrictions')].ipAddress]",
              "name": "[variables('scmIpSecurityRestrictions')[copyIndex('scmIpSecurityRestrictions')].name]",
              "priority": "[mul(add(copyIndex('scmIpSecurityRestrictions'), 1), 100)]"
            }
          }
        ],
        "scmIpSecurityRestrictionsUseMain": false,
        "netFrameworkVersion": "v4.6",
        "phpVersion": "5.6",
        "pythonVersion": "",
        "nodeVersion": "",
        "linuxFxVersion": "",
        "logsDirectorySizeLimit": 35,
        "scmType": "None",
        "use32BitWorkerProcess": true,
        "alwaysOn": true,
        "appCommandLine": "",
        "managedPipelineMode": "Integrated",
        "virtualApplications": [
          {
            "virtualPath": "/",
            "physicalPath": "site\\wwwroot",
            "preloadEnabled": true
          }
        ],
        "loadBalancing": "LeastRequests",
        "routingRules": [],
        "experiments": {
          "rampUpRules": []
        },
        "vnetName": "",
        "cors": {
          "allowedOrigins": [
            "https://functions.azure.com",
            "https://functions-staging.azure.com",
            "https://functions-next.azure.com"
          ]
        },
        "minTlsVersion": "1.0"
      },
      "dependsOn": [
        "[resourceId('Microsoft.Web/sites', 'test')]"
      ]
    }],
    "outputs": {}
}

Gives these validation errors:

Value must conform to exactly one of the associated schemas | Value must match the regular expression ^./appsettings$ at #/resources/0/name | Value must be one of the following types: string at #/resources/0/properties/numberOfWorkers | Value must be one of the following types: string at #/resources/0/properties/defaultDocuments | Value must be one of the following types: string at #/resources/0/properties/copy | Value must be one of the following types: string at #/resources/0/properties/scmIpSecurityRestrictionsUseMain | Value must be one of the following types: string at #/resources/0/properties/logsDirectorySizeLimit | Value must be one of the following types: string at #/resources/0/properties/use32BitWorkerProcess | Value must be one of the following types: string at #/resources/0/properties/alwaysOn | Value must be one of the following types: string at #/resources/0/properties/virtualApplications | Value must be one of the following types: string at #/resources/0/properties/routingRules | Value must be one of the following types: string at #/resources/0/properties/experiments | Value must be one of the following types: string at #/resources/0/properties/cors | or | Value must match the regular expression ^./authsettings$ at #/resources/0/name | or | Value must match the regular expression ^.*/azurestorageaccounts$ at #/resources/0/name | Value must be one of the following types: object at #/resources/0/properties/numberOfWorkers | Value must be one of the following types: object at #/resources/0/properties/defaultDocuments | Value must be one of the following types: object at #/resources/0/properties/copy | Value must be one of the following types: object at #/resources/0/properties/scmIpSecurityRestrictionsUseMain | Value must be one of the following types: object at #/resources/0/properties/netFrameworkVersion | Value must be one of the following types: object at #/resources/0/properties/phpVersion | Value must be one of the following types: object at #/resources/0/properties/pythonVersion | Value must be one of the following types: object at #/resources/0/properties/nodeVersion | Value must be one of the following types: object at #/resources/0/properties/linuxFxVersion | Value must be one of the following types: object at #/resources/0/properties/logsDirectorySizeLimit | Value must be one of the following types: object at #/resources/0/properties/scmType | Value must be one of the following types: object at #/resources/0/properties/use32BitWorkerProcess | Value must be one of the following types: object at #/resources/0/properties/alwaysOn | Value must be one of the following types: object at #/resources/0/properties/appCommandLine | Value must be one of the following types: object at #/resources/0/properties/managedPipelineMode | Value must be one of the following types: object at #/resources/0/properties/virtualApplications | Value must be one of the following types: object at #/resources/0/properties/loadBalancing | Value must be one of the following types: object at #/resources/0/properties/routingRules | Value must be one of the following types: object at #/resources/0/properties/vnetName | Value must be one of the following types: object at #/resources/0/properties/minTlsVersion |
| Error truncated. To find all possible valid values, please see document schema https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#

EXPECTED:

ARM Tools shouldn’t give any validation error. For instance, numberOfWorkers is in my code an integer, the validation error specifies it as string or object. It is strange that it should be both 😉 .

Besides that, when I look at the template numberOfWorkers is also specified as integer. Following the document schema which links to Microsoft.Web.json numberOfWorkers is also specified as integer.

In this repository the numberOfWorkers is also defined as integer.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
pmcilreavycommented, Jan 13, 2022

I’m still seeing this issue. It’s a real problem as it makes the extension almost unusable. You end up seeing so many validation errors for things that aren’t validation errors (like numberOfWorkers) that it makes it hard to find the real errors. It really seems like a high priority issue. Many of the MSFT docs direct users to use the ARM VS Code extension to develop and validate their templates but at the moment it’s very difficult to use because of this issue. It reduces confidence in the tool as none of the validation errors can be trusted and as a user, I then have to spend a lot of time figuring out which are the true validation errors from those that are just bugs. The latest activity on this is March 2021. Is there any idea when this might be addressed? or is there a workaround for now? Thanks.

0reactions
anthony-c-martincommented, Feb 1, 2022

I’ve responded to https://github.com/microsoft/vscode-azurearmtools/issues/1240 - ultimately I think we’re going as far as we realistically can with a pure JSON schema solution; I think we will need to collaborate on building more intelligence into the extension to solve this problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

You see validation errors for users in the Office 365 portal or in ...
You (the administrator) receive validation errors in the Office 365 portal or in the Microsoft Azure Active Directory Module for Windows PowerShell.
Read more >
Invalid template errors - Azure Resource Manager
Describes how to resolve invalid template errors when deploying Bicep files or Azure Resource Manager templates (ARM templates).
Read more >
Incorrect XML validation error when you add a BAM tracking ...
Symptoms. Consider the following scenario: You use the XML pipeline validator to validate schemas in Microsoft BizTalk Server 2010 or Microsoft BizTalk ...
Read more >
Resolving view state message authentication code (MAC) errors
What causes MAC validation errors? A MAC validation error will resemble the following example: ... [ViewStateException: Invalid viewstate. Client IP: ::1
Read more >
Form Validation - incorrect error message
Hi, I have a weird situation. I have a date field on the form and I have disabled the date-picker from picking future...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found