Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

indexOf expected parameters wrong #1515

Open
ghost opened this issue Sep 19, 2022 · 2 comments
Open

indexOf expected parameters wrong #1515

ghost opened this issue Sep 19, 2022 · 2 comments

Comments

@ghost
Copy link

ghost commented Sep 19, 2022

Hey,

we tested ARM/AzurePolicies with the indexOf/ lastIndexOf functions. Both support arrays according to docs. But the vscode extension complains that only strings are supported:

"[
    indexOf(
        parameters('testingArray'),
        'test02')
]"
Template validation failed: The template variable 'test' is not valid: The template language function 'indexOf' expects its parameters to be of type string and string. The provided value is of type 'Array' and 'String'. Please see https://aka.ms/arm-template-expressions#indexOf for usage details.. Please see https://aka.ms/arm-template-expressions for usage details.arm-template (validation)

We used the following template as a test:

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "resources": [],
    "parameters": {
        "testingArray": {
            "type": "array",
            "metadata": {
                "description": "description"
            },
            "defaultValue": [
                "test00",
                "test01",
                "test02",
                "test03"
            ]
        }
    },
    "variables": {
        "test": "[indexOf(parameters('testingArray'), 'test02')]"
    },
    "outputs": {
        "output1": {
            "type": "int",
            "value": "[variables('test')]"
        }
    }
}

The template is working as expected when deployed to azure.

The Azure Policy Extension has the same Bug so i expect the error somewhere deeper, but i couldn't find a Repo for the language server. So please let me know if this can be fixed for both extensions in the language server or I need to open another issue for the other extension.

Best regards
Thimo

@ghost ghost added the triage label Sep 19, 2022
@StephenWeatherford
Copy link
Contributor

@QBY-ThimoLimpert You should also open a bug against the other extension, thanks.

@StephenWeatherford
Copy link
Contributor

Blocked by #1458

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

No branches or pull requests

1 participant