Skip to content

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

Open

Description

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)
		}
	}
	// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

App ServicesMgmtThis issue is related to a management-plane library.Service AttentionWorkflow: This issue is responsible by Azure service team.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions