Skip to content

Verify az and kubectl presence before script execution - #44

Merged
paolosalvatori merged 1 commit into
mainfrom
check-tools-installation
Oct 14, 2026
Merged

paolosalvatori merged 1 commit into
mainfrom
check-tools-installation

Conversation

@paolosalvatori

Copy link
Copy Markdown
Collaborator

Motivation

This pull requests fixes #35 and by verifying az and kubectl presence before script execution.

Fixes SMF-947

Changes

This pull request adds the following checks at the beginning of the /scripts/01-system-assigned-managed-identity.sh and scripts/01-user-assigned-managed-identity.sh scripts:

#!/bin/bash

# Check prerequisites
missing=0
for tool in az kubectl; do
  if ! command -v "$tool" >/dev/null 2>&1; then
    echo "Error: required tool '$tool' is not installed or not in PATH." >&2
    missing=1
  fi
done
if [ "$missing" -ne 0 ]; then
  echo "Please install the missing tool(s) and re-run the script." >&2
  echo "  az:      https://learn.microsoft.com/cli/azure/install-azure-cli" >&2
  echo "  kubectl: https://kubernetes.io/docs/tasks/tools/ (or: az aks install-cli)" >&2
  exit 1
fi

Copilot AI balanced review requested due to automatic review settings October 14, 2026 14:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

Both scripts correctly fail before provisioning when required tools are unavailable and pass Bash syntax validation.

0 open findings

What changed in this PR

Adds fail-fast prerequisite checks for Azure CLI and kubectl before AKS provisioning begins.

Changes:

  • Validates both required executables and reports installation guidance.
  • Corrects the system-assigned script’s network selection prompt.
File Description
scripts/​01-user-assigned-managed-identity.sh Adds prerequisite validation.
scripts/​01-system-assigned-managed-identity.sh Adds prerequisite validation and corrects the menu heading.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@paolosalvatori
paolosalvatori merged commit 7d7b2b3 into main Oct 14, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Check for required tools at the start of the 01-* scripts

2 participants