Open
Description
Hello,
We have a AKS cluster with a user assigned managed identity but we cant update the cluster using the REST API or the Portal
Reproduction steps
1. create a aks cluster using Terraform:
- make
main.tf
file with following config:
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "=2.46.0"
}
}
}
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "example" {
name = "example-resources"
location = "West Europe"
}
resource "azurerm_user_assigned_identity" "example" {
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
name = "example_user_assigned_identity"
}
resource "azurerm_kubernetes_cluster" "example" {
name = "example-aks1"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
dns_prefix = "exampleaks1"
default_node_pool {
name = "default"
node_count = 1
vm_size = "Standard_D2_v2"
}
identity {
type = "UserAssigned"
user_assigned_identity_id = azurerm_user_assigned_identity.example.id
}
}
- execute
terraform init
- execute
terraform apply -auto-approve
2.1 updating using the Terraform
- added following to the AKS resource in terraform:
api_server_authorized_ip_ranges = ["168.63.129.16"]
- execute
terraform apply -auto-approve
-> error:
Error: updating Managed Kubernetes Cluster "example-aks1" (Resource Group "example-resources"): containerservice.ManagedClustersClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="InvalidIdentityValues" Message="Invalid value for the identities '/subscriptions/***/resourceGroups/example-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/example_user_assigned_identity'. The 'UserAssignedIdentities' property keys should only be empty json objects, null or the resource exisiting property."
on main.tf line 25, in resource "azurerm_kubernetes_cluster" "example":
25: resource "azurerm_kubernetes_cluster" "example" {
2.2 updating using the Rest API
If we want to update the aks cluster with 'createorupdate'(API version: 2021-02-01
) rest call with the json obtained from the 'get'(API version: 2021-02-01
) rest call we get the following error:
{
"error": {
"code": "InvalidIdentityValues",
"message": "Invalid value for the identities '/subscriptions/***/resourceGroups/***/providers/Microsoft.ManagedIdentity/userAssignedIdentities/***'. The 'UserAssignedIdentities' property keys should only be empty json objects, null or the resource exisiting property."
}
}
2.3 updating using the Azure Portal
if we want to set authorized IP ranges
the aks cluster in portal we get the same error:
Thanks!
Activity