Open robinmanuelthiel opened 3 years ago
Hi
There is a method on how to add tags, you need to use an SPN (either at aro creation, either you assigned after as a contributor).
See the example below:
If you created an ARO with SPN
# Login with the SPN
z login --service-principal --username $AROSPID --password $TaggingSecret --tenant $TENANT_ID --allow-no-subscriptions
az account set --subscription <Subscription-ID>
# Update the RG with the tag (here I updated the ARO node RG - the group that has the nodes in it as an example)
az group update --resource-group aro-opt3q6gh --set tags.CostCenter='{"Dept":"IT","Environment":"Test"}'
az tag list --resource-id /subscriptions/xxxxxxxxxxxxxxxxxx/resourceGroups/aro-opt3q6gh
If your ARO cluster was created without an SPN
• Create separately an SPN • Attach the newly created SPN to you ARO groups with contributor role • Update the ARO with the new SPN using the json patch • Log in with the SPN and add tags (like presented above)
Create a JSON file "ssp.json" with the following contents, where AZURE_SUBSCRIPTION_ID, RESOURCEGROUP, CLUSTER, and LOCATION are replaced with cluster parameters, and you need to find in the cluster json how the subnet is looking and the syntax
cat <<EOF > ssp.json
{
"id": "/subscriptions/xxxxxxxxxxxxx/resourceGroups/aro-public-gr/providers/Microsoft.RedHatOpenShift/OpenShiftClusters/aro-public-cluster",
"name": "aro-public-cluster",
"type": "Microsoft.RedHatOpenShift/openShiftClusters",
"location": "eastus",
"properties": {
"servicePrincipalProfile": {
"clientId": "xxxxxxx",
"clientSecret": "xxxxx"
}
}
}
EOF
After that run the following command to send a raw API request
az rest --method patch --url https://management.azure.com/subscriptions/xxxxxxxxxxx/resourceGroups/aro-public-gr/providers/Microsoft.RedHatOpenShift/OpenShiftClusters/aro-public-cluster?api-version=2020-04-30 --body @ssp.json
With respect, Andra
Currently, there is no way to update Tags for the
aro-xxxx
Resource Group. When creating a cluster withaz aro create
, we can add tags once with the--tags
option.This option does not exist for
az aro update
. Please bring it in!