bicep
bicep copied to clipboard
Unable to initialize kubernetes provider with `listClusterAdminCredential()`
Bicep version
❯ az bicep version
Bicep CLI version 0.27.1 (4b41cb6d4b)
Describe the bug
I am attempting to create an AKS cluster and initialize the Bicep extensibility Kubernetes provider and am unable to do so, running az deployment group create
I get the following error:
InvalidTemplate - Deployment template language expression evaluation failed: 'The template function 'listClusterAdminCredential' is not expected at this location. Please see https://aka.ms/arm-functions for usage details.'. Please see https://aka.ms/arm-functions for usage details.
To Reproduce Steps to reproduce the behavior:
- Reference an existing AKS cluster or create a new one, then try to retrieve its kubeconfig and use it
resource aks 'Microsoft.ContainerService/managedClusters@2024-02-01' existing = {
name: 'aks'
}
provider kubernetes with {
kubeConfig: aks.listClusterAdminCredential().kubeconfigs[0].value
namespace: 'default'
}
- Attempt to deploy it, e.g.
az deployment group create --name "test" --resource-group "test" --template-file "test.bicep" --confirm-with-what-if
Additional context
- Trying to follow the documentation in https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/bicep-extensibility-kubernetes-provider
- I was able to find a similar report in https://github.com/Azure/bicep-extensibility/issues/134#issuecomment-1533875049 if that's a better place for this