[AZINTS-4124] Guard against manually copying script#78
Merged
benjjs merged 4 commits intoNov 4, 2025
Merged
Conversation
gpalmz
approved these changes
Nov 4, 2025
| def main(): | ||
| if missing_environment_vars := REQUIRED_ENVIRONMENT_VARS - os.environ.keys(): | ||
| missing_environment_vars = [ | ||
| var for var in REQUIRED_ENVIRONMENT_VARS if var not in os.environ.keys() or not os.environ[var] |
Collaborator
There was a problem hiding this comment.
Nit: could simplify to var for var in REQUIRED_ENVIRONMENT_VARS if not os.environ.get(var)?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
If the user tries to copy the commands from the UI to run the onboarding script using Ctrl+C rather than the button we provide, they will end up with commands missing the API and app keys. Previously this would show up as an azure login fail, which is very misleading.
Summary
First, fix the environment variable check so that we count empty strings as missing variables, as this is what we'll get if they copy the command incorrectly. Then, if we detect that they are specifically missing both the API and App keys, we show a special message suggesting that they may have tried to copy the command manually and to use the button instead.
I also realized that we were reporting login failures as script errors when in fact this is a user error, and moreover one that they can fix immediately in the shell without reloading the shell or the UI, unlike most user actionable errors we catch. As such, I've created a new category of "retriable" errors for things the user can fix and then re-run the command to connect without issue.
Errors of this type are reported to the status API with the new "WARN" status so as not to be counted as errors or displayed in the UI, since both of these things are undesirable. I will make a follow up PR to log these as warnings, as the name would suggest.
Testing
Try copying the wrong way, paste into local shell. I see the new warning as expected

Try logging out or uninstalling script. It now comes through with the new "WARN" status and does not show anything in the UI.

Finally try connecting normally just to make sure it still works. It does.