Snippets Collections
$RG = "di-platform-dev-rg-execution"
$NAME = "di-platform-dev-k8s-exe"

$SP_ID=$(az aks show --resource-group "$RG" --name "$NAME" \
    --query servicePrincipalProfile.clientId -o tsv)

az ad sp credential list --id "$SP_ID" --query "[].endDate" -o tsv

$SP_ID=$(az aks show --resource-group "$RG" --name "$NAME" \
    --query servicePrincipalProfile.clientId -o tsv)

$SP_SECRET=$(az ad sp credential reset --name "$SP_ID" --query password -o tsv)

az aks update-credentials \
    --resource-group "$RG" \
    --name $NAME" \
    --reset-service-principal \
    --service-principal "$SP_ID" \
    --client-secret "$SP_SECRET"
star

Mon Oct 25 2021 17:48:18 GMT+0000 (Coordinated Universal Time) https://docs.microsoft.com/en-us/azure/aks/update-credentials?WT.mc_id=Portal-Microsoft_Azure_Expert#update-aks-cluster-with-new-service-principal-credentials

#powershell #k8s #spn #reset #expired #expire

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension