Hello @thiyagu rajendran ,
You might have to define the vnetname , subnetname
"VnetName": {
"type": "string",
"defaultValue": "vnet",
"metadata": {
"description": "The product k8s cluster vnet"
}
},
"SubnetName": {
"type": "string",
"defaultValue": "subnet",
"metadata": {
"description": "The product k8s cluster subnet name"
}
},
Then in the agent pool properties , you have to define the vnetSubnetID
"agentPoolProfiles": [
{
"name": "agentpool",
"osDiskSizeGB": 0,
"count": 1,
"vmSize": "[parameters('agentVMSize')]",
"osType": "[parameters('osType')]",
"storageProfile": "ManagedDisks",
"vnetSubnetID": "[concat(resourceId('Microsoft.Network/virtualNetworks',parameters('vnetname')),'/subnets/',parameters('subnetname'))]"
}
Then you can use the : properties.agentPoolProfiles[0].vnetSubnetID
If you are still facing the issue , kindly share the complete template which is used to create Private AKS Cluster + Along with another template which are used to create other resources.
Couple of references:
https://learn.microsoft.com/en-us/azure/templates/Microsoft.ContainerService/2019-02-01/managedClusters?tabs=json#quickstart-templates
https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/outputs?tabs=azure-powershell
FYI:
In the template which you have shared , in the outputs section you are using a variable "testcluster" which is not defined as a part of Variables section the ARM template , it was defined in the Resources section which you can't reference by variables.
"outputs": {
"clusterSubnetId": {
"type": "string",
"value": "[reference(variables('testcluster'), '2021-08-01', 'Full').properties.agentPoolProfiles[0].vnetSubnetID]"
}
}
Regards,
Shiva.