I am in the initial stage but some help would really be appreciated. I am writing this to get the my subscription and resource group details from the az-tag reports. I am using that csv file to provide the input to my script. Below is my script.
#! /bin/bash
subscription=$(csvcut -c 4 azr-ichsprod_missing_tags_Oct24.csv | awk -F 'azure:|:' '{print $2}')
resourceGroups=$(csvcut -c 4 azr-ichsprod_missing_tags_Oct24.csv | awk -F '/resourceGroups/|/' '{print $4}')
while IFS="," read -r resource_type resource_type
do
echo "Displaying subscription-$resource_type"
echo "$resourceGroups: $resource_type"
echo ""
done < <(cut -d "," -f${subscription},${resourceGroups} input.csv | tail -n +2)
Can someone please help as this is failing because csv kit is unrecognized in this script.
I am trying to get the subscription id and resource group out of the csv file. So that I can check for those resource group and add the tags on those resources. Here is my sample file
2022-10-24T00-00-00Z,aks,6BB0751B4655C6EC91CF227661EA9F850242,0d29840b-a466-457a-ad25-a83d1b35c2ccadfgksd:eastus:aks:/subscriptions/0d29840b-a466-457a-ad25-a83d1b35c2ccadfgksd/resourcegroups/ABCCLOUD-STAGING-USEAST-AKS-RG/providers/Microsoft.ContainerService/managedClusters/abcloud-stgdr-aks-stage-useast,DAB6DFC753F70030B6EC160A0EDE2E81,azure,0d29840b-a466-457a-ad25-a83d1b35c2cc,eastus,"(not set)","(not set)",/subscriptions/0d29840b-a466-457a-ad25-a83d1b35c2ccadfgksd/resourcegroups/ABCCLOUD-STAGING-USEAST-AKS-RG/providers/Microsoft.ContainerService/managedClusters/abccloud-stgdr-aks-stage-useast,"(not set)","(not set)","(not set)","(not set)","(not set)",1970-01-01T00:00:00,0.0.0.0,"(not set)",eastus-abcCLOUD-STAGING-USEAST-AKS-RG,"(not set)","(not set)","(not set)","(not set)","(not set)"