Azure CLI installation
-
As I'm writing this, I'm riding a train to work. I'm a bit bored, so I thought "I'll give Azure CLI a try - I like how the Powershell tooling works on Windows so it must be okay on macOS as well, right?"
WRONG.
Here's my installation experience so far:
- Install by piping the output of cURL to bash,
- Throwing gibberish at me and asking me questions that I don't care about,
Alexs-MacBook-Air:~ alex$ sudo curl -L https://aka.ms/InstallAzureCli | bash Password: % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 167 100 167 0 0 112 0 0:00:01 0:00:01 --:--:-- 112 100 1367 100 1367 0 0 521 0 0:00:02 0:00:02 --:--:-- 4633 Downloading Azure CLI install script from https://azurecliprod.blob.core.windows.net/install.py to /var/folders/0_/kml08r6s0kq5lmygdzrvfpg00000gn/T/azure_cli_install_tmp_XXXX.55xR1Ejq. ######################################################################## 100.0% /var/folders/0_/kml08r6s0kq5lmygdzrvfpg00000gn/T/azure_cli_install_tmp_XXXX.55xR1Ejq: OK Running install script. -- Verifying Python version. -- Python version 2.7.10 okay. ===> In what directory would you like to place the install? (leave blank to use '/Users/alex/lib/azure-cli'): -- Creating directory '/Users/alex/lib/azure-cli'. -- We will install at '/Users/alex/lib/azure-cli'. ===> In what directory would you like to place the 'az' executable? (leave blank to use '/Users/alex/bin'): -- Creating directory '/Users/alex/bin'. -- The executable will be in '/Users/alex/bin'.
-
Showing random popups,
-
Erroring out without telling me what to do next,
Good job, Microsoft, at staying true to the Open Source Experience .
-
Fucking Python.
-
I've restarted the script and now it continues beyond where it broke the last time. Now it wants to know this:
===> Modify profile to update your $PATH and enable shell/tab completion now? (Y/n):
What does this even mean Why is this a question? What if I say no, won't I then be able to use it?
-
===> Modify profile to update your $PATH and enable shell/tab completion now? (Y/n): n -- If you change your mind, add 'source /Users/alex/lib/azure-cli/az.completion' to your rc file and restart your shell to enable tab completion. -- You can run the CLI with '/Users/alex/bin/az'. -- Installation successful. -- Run the CLI with /Users/alex/bin/az --help
What? Where is "your rc file"? How do I update it? How am I supposed to remember any of this?
-
@alexmedia This command line looks really strange:
sudo curl -L https://aka.ms/InstallAzureCli | bash
The thing that is wrong? You're elevating the process that doesn't (well, damn well shouldn't!) need it, and not elevating the process that might well need it if it is doing stupid installation stuff. Even though I think that
sudo bash
is pretty bad too, at least it would make logical sense. A failure to elevate the right process might explain the later failures.I'd expect one of these to work better:
Elevate the installation instruction processor
curl -L https://aka.ms/InstallAzureCli | sudo bash
Elevate ALL THE THINGS
sudo bash -c 'curl -L https://aka.ms/InstallAzureCli | bash'
-
@alexmedia said in Azure CLI installation:
===> Modify profile to update your $PATH and enable shell/tab completion now? (Y/n): n -- If you change your mind, add 'source /Users/alex/lib/azure-cli/az.completion' to your rc file and restart your shell to enable tab completion. -- You can run the CLI with '/Users/alex/bin/az'. -- Installation successful. -- Run the CLI with /Users/alex/bin/az --help
What? Where is "your rc file"? How do I update it? How am I supposed to remember any of this?
Uuuuh, yeah, you should have said "Y"...
If you don't know what PATH is... you should probably learn about that before you start playing around in CLI, cause that's kinda a core concept...
-
@alexmedia said in Azure CLI installation:
What if I say no, won't I then be able to use it?
Basically, yea. It won't be on your
$PATH
, meaning you won't be able to use it without doing the full entire path to the executable any time you want to run it.So, instead of
az -stuff
you have to do/full/long/path/to/executable/az -stuff
-
@dkf I guess I haven't had enough coffee yet. When I reran the command I totally omitted the sudo and it finished installing just fine.
@sloosecannon I know what PATH is, I just don't understand the question. Why does it bother asking in the first place? If it is that important, why doesn't it add itself to my $PATH by default and print a "for convenience I've added myself to your $PATH. You're welcome."?
-
@alexmedia said in Azure CLI installation:
why doesn't it add itself to my $PATH by default and print a "for convenience I've added myself to your $PATH. You're welcome."?
Because idiots will complain about it... also, it could probably break for raisins, so they gave you the choice.
(yes, I really wanted to use that image...)
-
@sloosecannon said in Azure CLI installation:
(yes, I really wanted to use that image...)
And I really wanted to upvote you for using it!
-
@alexmedia said in Azure CLI installation:
Why does it bother asking in the first place?
Even many Windows software installers have a tickbox for "Add to PATH variable?" so it's a pretty common question. Not sure why you're worked up about being given a choice in the matter.
-
@lb_ said in Azure CLI installation:
@alexmedia said in Azure CLI installation:
Why does it bother asking in the first place?
Even many Windows software installers have a tickbox for "Add to PATH variable?" so it's a pretty common question. Not sure why you're worked up about being given a choice in the matter.
-
@lb_ said in Azure CLI installation:
Even many Windows software installers have a tickbox for "Add to PATH variable?" so it's a pretty common question. Not sure why you're worked up about being given a choice in the matter.
I like to follow the "Don't make me think" principle. Give me sensible defaults, and give me an option to change them if I want to.
Questions like "where do you want to install?" and "add to path?" will be answered with the defaults / Yes by approximately 95% of the users, so why even bother asking for input in the first place while you just as well might propose default values and only change them if the user explicitly asks you to.
-
@alexmedia Ah, the “Express Installation” option.
-
@alexmedia said in Azure CLI installation:
you just as well might propose default values and only change them if the user explicitly asks you to.
They did - you could have hit "Enter" and it would've chosen "Y" :)
-
@alexmedia said in Azure CLI installation:
What? Where is "your rc file"? How do I update it? How am I supposed to remember any of this?
It's standard bash stuff:
~/.bashrc
. It's going to tell bash about its commands so that you'll get smart tab autocomplete. Like, bash will know about options or whether it should be looking for a file, or maybe even filter them somehow, depending on what you're doing (and how much they put into it).You definitely want it.
-
@sloosecannon said in Azure CLI installation:
If you don't know what PATH is... you should probably learn about that before you start playing around in CLI, cause that's kinda a core concept...
Same for the RC file.
-
@asdf I don't know, I could definitely see knowing about PATH and not knowing about the rc file. I administer Linux servers and still would forget about it until reminded as I don't customize my shell typically.
-
@heterodox said in Azure CLI installation:
I don't customize my shell typically.
About the only thing I do is
export EDITOR=nano
.
-
I reran the installer and followed the defaults EVERYWHERE.
-- The executable is available at '/Users/alex/bin/az'. -- Created tab completion file at '/Users/alex/lib/azure-cli/az.completion' ===> Modify profile to update your $PATH and enable shell/tab completion now? (Y/n): ===> Enter a path to an rc file to update (leave blank to use '/Users/alex/.bash_profile'): -- Backed up '/Users/alex/.bash_profile' to '/Users/alex/.bash_profile.backup' -- Tab completion set up complete. -- If tab completion is not activated, verify that '/Users/alex/.bash_profile' is sourced by your shell. -- -- ** Run `exec -l $SHELL` to restart your shell. ** -- -- Installation successful. -- Run the CLI with /Users/alex/bin/az --help Alexs-MacBook-Air:~ alex$ exec -l $SHEL Alexs-MacBook-Air:~ alex$ az -bash: az: command not found Alexs-MacBook-Air:~ alex$
Well I'll be darned, it doesn't work.
I'm not even surprised.
edit: completely quitting Terminal and restarting it magically fixed it.
-
@alexmedia said in Azure CLI installation:
completely quitting Terminal and restarting it magically fixed it.
Had to reload
$PATH
-
@alexmedia said in Azure CLI installation:
-- ** Run `exec -l $SHELL` to restart your shell. ** -- -- Installation successful. -- Run the CLI with /Users/alex/bin/az --help Alexs-MacBook-Air:~ alex$ exec -l $SHEL
Spelled $SHELL wrong, there.
-
Ah, I see :)
I blindly copy-pasta'd it and hit enter. I should've known better than that.
-
Does PASH work on MacOS?
-
@alexmedia said in Azure CLI installation:
I blindly copy-pasta'd it and hit enter. I should've known better than that.
@heterodox said in Azure CLI installation:
** Run
exec -l $SHELL
to restart your shell. **@heterodox said in Azure CLI installation:
Alexs-MacBook-Air:~ alex$ exec -l $SHEL
Not very well, you didn't.
-
Wait, SUDO CURL? The HTTP request requires root but the installer doesn't?
-
Nah, when I typed that command I hadn't consumed enough caffeine yet.
Also, I've got Azure CLI working. It's... interesting... but nowhere near as sophisticated as the Powershell equivalent.
-
@boomzilla said in Azure CLI installation:
About the only thing I do is
export EDITOR=nano
.You should add this
#when you forget to type sudo alias fuck='sudo $(history -p \!\!)'
-
@timebandit said in Azure CLI installation:
@boomzilla said in Azure CLI installation:
About the only thing I do is
export EDITOR=nano
.You should add this
#when you forget to type sudo alias fuck='sudo $(history -p \!\!)'
But that breaks this
-
@sloosecannon But then, I'll have Python on me
-
@timebandit said in Azure CLI installation:
@sloosecannon But then, I'll have Python on me
Nah, you just need it on your system :)