Skip to content

Conversation

leggetter
Copy link
Collaborator

… with role checks

@Copilot Copilot AI review requested due to automatic review settings August 13, 2025 08:52
Copy link

vercel bot commented Aug 13, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Project Deployment Preview Comments Updated (UTC)
outpost-docs Ready Preview Comment Aug 13, 2025 8:53am
outpost-website Ready Preview Comment Aug 13, 2025 8:53am

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances Azure diagnostics capabilities by adding a new cleanup script and improving role permission checking in the existing diagnostics script.

  • Added a new diagnostics-clean.sh script for cleaning up diagnostic data from both local and Azure environments
  • Enhanced diagnostics.sh with more comprehensive Azure Service Bus role permission checking across different scopes
  • Fixed a syntax error in dependencies.sh and added an example environment variable comment

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
examples/azure/local-deploy.sh Added commented example for TOPICS environment variable configuration
examples/azure/diagnostics.sh Enhanced Azure Service Bus permission checking with multi-scope role validation
examples/azure/diagnostics-clean.sh New script for cleaning up diagnostic data from local and Azure environments
examples/azure/dependencies.sh Fixed missing line continuation backslash in Redis configuration

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

;;
*)
shift
;;
Copy link

Copilot AI Aug 13, 2025

Choose a reason for hiding this comment

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

The wildcard case in the argument parser silently ignores unknown arguments without providing user feedback. Consider adding an echo statement to warn users about unrecognized arguments or exit with an error for better user experience.

Suggested change
;;
echo "❌ Unknown argument: $1" >&2
exit 1

Copilot uses AI. Check for mistakes.

local base_url=$1
local env_name=$2
echo "🧹 Cleaning up $env_name environment at $base_url..."
TENANT_ID="diagnostics-tenant-x"
Copy link

Copilot AI Aug 13, 2025

Choose a reason for hiding this comment

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

The tenant ID is hardcoded as a magic string. Consider making this configurable via an environment variable or function parameter to improve flexibility and maintainability.

Suggested change
TENANT_ID="diagnostics-tenant-x"

Copilot uses AI. Check for mistakes.


echo " (Fetching destinations for tenant: $TENANT_ID...)"
DESTINATION_IDS=$(curl -sf -X GET "$base_url/api/v1/$TENANT_ID/destinations" \
-H "Authorization: Bearer $API_KEY" | jq -r '.[].id')
Copy link

Copilot AI Aug 13, 2025

Choose a reason for hiding this comment

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

The curl command uses the -s flag which suppresses error output, making debugging difficult if the API call fails. Consider providing more descriptive error handling or logging when the API request fails.

Suggested change
-H "Authorization: Bearer $API_KEY" | jq -r '.[].id')
CURL_OUTPUT=$(mktemp)
if ! curl -f -X GET "$base_url/api/v1/$TENANT_ID/destinations" \
-H "Authorization: Bearer $API_KEY" >"$CURL_OUTPUT" 2>"$CURL_OUTPUT.err"; then
echo " -> ❌ Failed to fetch destinations for tenant $TENANT_ID."
echo " curl error output:"
cat "$CURL_OUTPUT.err"
rm -f "$CURL_OUTPUT" "$CURL_OUTPUT.err"
return 1
fi
DESTINATION_IDS=$(jq -r '.[].id' <"$CURL_OUTPUT")
rm -f "$CURL_OUTPUT" "$CURL_OUTPUT.err"

Copilot uses AI. Check for mistakes.

@leggetter leggetter merged commit 8683052 into main Aug 13, 2025
4 checks passed
@leggetter leggetter deleted the chore/azure-script-updates branch August 13, 2025 08:57
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.

1 participant