Azure / bicep-types-az

Bicep type definitions for ARM resources
MIT License
84 stars 27 forks source link

Unable to create Microsoft.EventHub/namespaces due to bad errors from CLI and linter #2022

Open adameska opened 8 months ago

adameska commented 8 months ago

Describe the bug Currently our bi cep is creating a event hub like this: resource evhnssplunk 'Microsoft.EventHub/namespaces@2022-10-01-preview' ...

I got an error saying it was old, the handy bicep intellisense told me latest was 2024-01-01, great! Tried that and get this error: ERROR: {"status":"Failed","error":{"code":"DeploymentFailed","target":"/subscriptions/ef5f5f98-119a-40a0-8bae-d4b10bd13a96/resourceGroups/rg-test-eventhub-splunk-eus2/providers/Microsoft.Resources/deployments/create_eventhub_eastus2-","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.","details":[{"code":"NoRegisteredProviderFound","message":"No registered resource provider found for location 'eastus2' and API version '2024-01-01' for type 'namespaces'. The supported api-versions are '2017-04-01, 2018-01-01-preview, 2021-01-01-preview, 2021-06-01-preview, 2021-11-01, 2022-01-01-preview, 2022-10-01-preview, 2023-01-01-preview, 2014-09-01, 2015-08-01'. The supported locations are 'australiacentral, australiaeast, australiasoutheast, brazilsouth, canadacentral, canadaeast, centralindia, centralus, eastasia, eastus, eastus2, francecentral, germanywestcentral, israelcentral, italynorth, japaneast, japanwest, jioindiawest, koreacentral, koreasouth, northcentralus, northeurope, norwayeast, polandcentral, qatarcentral, southafricanorth, southcentralus, southeastasia, southindia, swedencentral, switzerlandnorth, uaenorth, uksouth, ukwest, westcentralus, westeurope, westindia, westus, westus2, westus3'."}]}}

Ok... so maybe i need to use 2023-01-01-preview since that's the latest from that error... try that and this is the error i get... /home/vsts/work/1/s/infra-as-code/bicep/modules/eventHubs/eventHubs.bicep(11,53) : Error use-recent-api-versions: Use more recent API version for 'Microsoft.EventHub/namespaces'. '2023-01-01-preview' is a preview version and there is a more recent non-preview version available. Acceptable versions: 2024-01-01 [https://aka.ms/bicep/linter/use-recent-api-versions]

So now i'm in a catch22, i can't deploy this because of these errors. On top of all that, the official site doesn't even show 2023 or 2024 versions... https://learn.microsoft.com/en-us/azure/templates/microsoft.eventhub/namespaces?pivots=deployment-language-bicep

I'm going to look at disabling our linter rules but this just seems wrong and isn't the first time the bicep linter gave me a newer version that the CLI tolerated or existed in documentation but this is the first time that the reverse also happened and blocked me...

adameska commented 8 months ago

Ok... i'm starting to think this may be due to the ubuntu-latest image not having the latest CLI installed... i did run az upgrade (after jumping some hoops) and got the CLI to 2.56.0 but it still failed with the same error... also i don't even see 2024 in this list even on my windows machine that somehow bicep build passed on.

az provider show --namespace Microsoft.EventHub --query "resourceTypes[].{ResourceType:resourceType, ApiVersions:apiVersions}" [ { "ApiVersions": [ "2023-01-01-preview", "2022-10-01-preview", "2022-01-01-preview", "2021-11-01", "2021-06-01-preview", "2021-01-01-preview", "2018-01-01-preview", "2017-04-01", "2015-08-01", "2014-09-01" ], "ResourceType": "namespaces" },

lukembis commented 7 months ago

I am experiencing the same issue but in North Europe. We've had to change the use-recent-api-versions Bicep linting rule from error to warn to work around this but it would be good if we can switch this back soon.

microsoft-github-policy-service[bot] commented 7 months ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Saglodha. Please see https://aka.ms/biceptypesinfo for troubleshooting help.

roshangri commented 7 months ago

Same issue while trying to create a video indexer - australia east { "error": { "code": "UNSUPPORTED", "message": "No registered resource provider found for API version '2024-01-01' for type 'accounts'. The supported api-versions are '2021-10-18-preview, 2021-10-27-preview, 2021-11-10-preview, 2022-04-13-preview, 2022-07-20-preview, 2023-06-02-preview, 2022-08-01'. Trace id: 'd07b7e64-39d0-4f61-923a-6346a241f047'." } }

akoufa commented 4 months ago

Same issue here using Bicep CLI version 0.26.170 and westeurope

peterkuiper commented 4 months ago

We are experiencing this as well in westeurope. Any update on this? Running az provider show --namespace Microsoft.EventHub --query "resourceTypes[].{ResourceType:resourceType, ApiVersions:apiVersions}" returns the same API versions as for @adameska. As a workaround, we are using 2023-01-01-preview.