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

App Service module "The api-version '2023-12-01' is invalid." error #23479

Open
DMark05 opened this issue Sep 23, 2024 · 1 comment
Open

App Service module "The api-version '2023-12-01' is invalid." error #23479

DMark05 opened this issue Sep 23, 2024 · 1 comment
Labels
App Services customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team.

Comments

@DMark05
Copy link

DMark05 commented Sep 23, 2024

go version output:
go version go1.23.1 linux/amd64

I’ve been trying to use “github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appservice/armappservice/v4”, I encounter the following error anytime I want to call a function from a client:

{"errorMessage":"GET [https://management.azure.com/subscriptions/87de625c-2920-44ae-ba7c-9d62d0a9b8d9/resourceGroups//subscriptions/87de625c-2920-44ae-ba7c-9d62d0a9b8d9/resourceGroups/AzureBackupRG_francecentral_1/providers/Microsoft.Web/sites\\n--------------------------------------------------------------------------------\\nRESPONSE](https://management.azure.com/subscriptions/87de625c-2920-44ae-ba7c-9d62d0a9b8d9/resourceGroups//subscriptions/87de625c-2920-44ae-ba7c-9d62d0a9b8d9/resourceGroups/AzureBackupRG_francecentral_1/providers/Microsoft.Web/sites%5C%5Cn--------------------------------------------------------------------------------%5C%5CnRESPONSE) 400: 400 Bad Request\nERROR CODE: InvalidApiVersionParameter\n--------------------------------------------------------------------------------\n{\n \"error\": {\n \"code\": \"InvalidApiVersionParameter\",\n \"message\": \"The api-version '2023-12-01' is invalid. The supported versions are '2024-06-01-preview,2024-03-01,2023-07-01,2023-07-01-preview,2023-03-01-preview,2022-12-01,2022-11-01-preview,2022-09-01,2022-06-01,2022-05-01,2022-03-01-preview,2022-01-01,2021-04-01,2021-01-01,2020-10-01,2020-09-01,2020-08-01,2020-07-01,2020-06-01,2020-05-01,2020-01-01,2019-11-01,2019-10-01,2019-09-01,2019-08-01,2019-07-01,2019-06-01,2019-05-10,2019-05-01,2019-03-01,2018-11-01,2018-09-01,2018-08-01,2018-07-01,2018-06-01,2018-05-01,2018-02-01,2018-01-01,2017-12-01,2017-08-01,2017-06-01,2017-05-10,2017-05-01,2017-03-01,2016-09-01,2016-07-01,2016-06-01,2016-02-01,2015-11-01,2015-01-01,2014-04-01-preview,2014-04-01,2014-01-01,2013-03-01,2014-02-26,2014-04'.\"\n }\n}\n--------------------------------------------------------------------------------\n","errorType":"ResponseError"}

I also tried out v3, v2 and v1 and every version gave me the same error, except v2 and v1 which were using api version ‘2022-03-01’ and ‘2021-03-01’, respectively.

For context, my code looked something like this:

import (
	"context"
	"log"
	"os"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appservice/armappservice"
)

var TenantId       = os.Getenv("TenantId")
var ClientId       = os.Getenv("ClientId")
var Secret         = os.Getenv("Secret")
var SubscriptionId = os.Getenv("SubscriptionId")
var context        = context.Background()

func GetFunctionsFromResourceGroup(context context.Context, resourceGroup string, subscriptionID string) error {
	pager := WebAppsClient.NewListByResourceGroupPager(resourceGroup, nil)
	for pager.More() {
		page, err := pager.NextPage(context)
		if err != nil {
			log.Println("Failed to get next page of function apps")
			return err
		}

		// ...
	}

	//...
}

func main() {
	credentials, err := azidentity.NewClientSecretCredential(TenantId, ClientId, Secret, nil)
	if err != nil {
		log.Println("Couldn't create client credentials")
		panic(err)
	}
	WebAppsClient, err = armappservice.NewWebAppsClient(SubscriptionId, credentials, nil)
	if err != nil {
		panic(err)
	}

	resourceGroups, err := shared.GetResourceGroupsFromSubscription(context, SubscriptionId, credentials)
	if err != nil {
		log.Println("Couldn't get resource groups from subscriptions")
		panic(err)
	}

	for _, resourceGroup := range resourceGroups {
		err := GetFunctionsFromResourceGroup(context, resourceGroup.ResourceId, SubscriptionId)
		if err != nil {
			log.Println("Couldn't get functions from resource group")
			panic(err)
		}
	}
	// ...
}
@github-actions github-actions bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Sep 23, 2024
@jhendrixMSFT jhendrixMSFT added App Services Service Attention Workflow: This issue is responsible by Azure service team. Mgmt This issue is related to a management-plane library. and removed needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. labels Sep 23, 2024
@github-actions github-actions bot added the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Sep 23, 2024
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
App Services customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

2 participants