MS Azure/AZ104

AZ104 실습 : Azure CLI 설치 및 사용 in MAC

aliceintr 2021. 1. 8. 21:43
반응형

오늘은 가장 기본이 되는 Azure CLI Mac 용 설치 및 로그인을 해보도록 한다.

일단 터미널을 열고

brew update && brew install azure-cli
Already up-to-date.
==> Downloading https://homebrew.bintray.com/bottles/openssl%401.1-1.1.1i.big_s
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/8008537d37a7f09eedbc
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/pkg-config-0.29.2_3.big_su
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/0040b6ebe07f60549800
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/gdbm-1.18.1_1.big_sur.bott
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/36b492f1b0910367dd39
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/readline-8.1.big_sur.bottl
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/2cc3a9582e3c7e21eb3c
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/sqlite-3.34.0.big_sur.bott
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/cdf256befc0752680a67
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/xz-5.2.5.big_sur.bottle.ta
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/4fbd4a9e3eb49c27e83b
######################################################################## 100.0%
Warning: Building python@3.8 from source:
  The bottle needs the Apple Command Line Tools to be installed.
  You can install them, if desired, with:
    xcode-select --install

==> Downloading https://github.com/python/cpython/commit/09a698b4.patch?full_in
######################################################################## 100.0%
==> Downloading https://files.pythonhosted.org/packages/94/23/e9e3d96500c063129
######################################################################## 100.0%
==> Downloading https://files.pythonhosted.org/packages/ca/1e/d91d7aae44d00cd50
######################################################################## 100.0%
==> Downloading https://files.pythonhosted.org/packages/ed/46/e298a50dde405e1c2
######################################################################## 100.0%
==> Downloading https://www.python.org/ftp/python/3.8.7/Python-3.8.7.tar.xz
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/azure-cli-2.17.1.big_sur.b
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/bf3689587ffbc164ecba
######################################################################## 100.0%
==> Installing dependencies for azure-cli: openssl@1.1, pkg-config, gdbm, readline, sqlite, xz and python@3.8
==> Installing azure-cli dependency: openssl@1.1
==> Pouring openssl@1.1-1.1.1i.big_sur.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /usr/local/etc/openssl@1.1/certs

and run
  /usr/local/opt/openssl@1.1/bin/c_rehash

openssl@1.1 is keg-only, which means it was not symlinked into /usr/local,
because macOS provides LibreSSL.

If you need to have openssl@1.1 first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc

For compilers to find openssl@1.1 you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"

==> Summary
🍺  /usr/local/Cellar/openssl@1.1/1.1.1i: 8,067 files, 18.5MB
==> Installing azure-cli dependency: pkg-config
==> Pouring pkg-config-0.29.2_3.big_sur.bottle.tar.gz
🍺  /usr/local/Cellar/pkg-config/0.29.2_3: 11 files, 656.6KB
==> Installing azure-cli dependency: gdbm
==> Pouring gdbm-1.18.1_1.big_sur.bottle.tar.gz
🍺  /usr/local/Cellar/gdbm/1.18.1_1: 25 files, 787.2KB
==> Installing azure-cli dependency: readline
==> Pouring readline-8.1.big_sur.bottle.tar.gz
==> Caveats
readline is keg-only, which means it was not symlinked into /usr/local,
because macOS provides BSD libedit.

For compilers to find readline you may need to set:
  export LDFLAGS="-L/usr/local/opt/readline/lib"
  export CPPFLAGS="-I/usr/local/opt/readline/include"

For pkg-config to find readline you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/readline/lib/pkgconfig"

==> Summary
🍺  /usr/local/Cellar/readline/8.1: 48 files, 1.6MB
==> Installing azure-cli dependency: sqlite
==> Pouring sqlite-3.34.0.big_sur.bottle.tar.gz
==> Caveats
sqlite is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have sqlite first in your PATH run:
  echo 'export PATH="/usr/local/opt/sqlite/bin:$PATH"' >> ~/.zshrc

For compilers to find sqlite you may need to set:
  export LDFLAGS="-L/usr/local/opt/sqlite/lib"
  export CPPFLAGS="-I/usr/local/opt/sqlite/include"

For pkg-config to find sqlite you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/sqlite/lib/pkgconfig"

==> Summary
🍺  /usr/local/Cellar/sqlite/3.34.0: 11 files, 4.1MB
==> Installing azure-cli dependency: xz
==> Pouring xz-5.2.5.big_sur.bottle.tar.gz
🍺  /usr/local/Cellar/xz/5.2.5: 95 files, 1.4MB
==> Installing azure-cli dependency: python@3.8
==> Patching
==> Applying 09a698b4.patch
patching file Lib/distutils/spawn.py
Hunk #1 succeeded at 95 (offset 41 lines).
patching file Lib/distutils/tests/test_build_ext.py
patching file Lib/test/test_posix.py
Hunk #1 succeeded at 1046 (offset 1 line).
patching file Misc/NEWS.d/next/macOS/2020-12-02-15-48-40.bpo-42504.RQmMOR.rst
patching file setup.py
Hunk #1 succeeded at 927 (offset -85 lines).
==> ./configure --prefix=/usr/local/Cellar/python@3.8/3.8.7 --enable-ipv6 --datarootdir=/usr/local/Cellar/python@3.8/3.8.7/share --datadir=/usr/local/Cellar/p
==> make
==> make install PYTHONAPPSDIR=/usr/local/Cellar/python@3.8/3.8.7
==> make frameworkinstallextras PYTHONAPPSDIR=/usr/local/Cellar/python@3.8/3.8.7/share/python@3.8
==> /usr/local/Cellar/python@3.8/3.8.7/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python@3.8/3.8.7/bi
==> /usr/local/Cellar/python@3.8/3.8.7/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python@3.8/3.8.7/bi
==> /usr/local/Cellar/python@3.8/3.8.7/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python@3.8/3.8.7/bi
==> Caveats
Python has been installed as
  /usr/local/opt/python@3.8/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
  /usr/local/opt/python@3.8/libexec/bin

You can install Python packages with
  /usr/local/opt/python@3.8/bin/pip3 install <package>
They will install into the site-package directory
  /usr/local/lib/python3.8/site-packages

See: https://docs.brew.sh/Homebrew-and-Python

python@3.8 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have python@3.8 first in your PATH run:
  echo 'export PATH="/usr/local/opt/python@3.8/bin:$PATH"' >> ~/.zshrc

For compilers to find python@3.8 you may need to set:
  export LDFLAGS="-L/usr/local/opt/python@3.8/lib"

For pkg-config to find python@3.8 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/python@3.8/lib/pkgconfig"

==> Summary
🍺  /usr/local/Cellar/python@3.8/3.8.7: 9,210 files, 134.9MB, built in 2 minutes 29 seconds
==> Installing azure-cli
==> Pouring azure-cli-2.17.1.big_sur.bottle.tar.gz
🍺  /usr/local/Cellar/azure-cli/2.17.1: 18,432 files, 293.8MB
==> `brew cleanup` has not been run in 30 days, running now...
Removing: /Users/alice/Library/Caches/Homebrew/git--2.29.2.big_sur.bottle.tar.gz... (14.6MB)
Removing: /Users/alice/Library/Caches/Homebrew/helm--3.4.0.catalina.bottle.tar.gz... (12.2MB)
Removing: /Users/alice/Library/Caches/Homebrew/pcre2--10.35.big_sur.bottle.tar.gz... (2.0MB)
Removing: /Users/alice/Library/Logs/Homebrew/ncurses... (64B)
Removing: /Users/alice/Library/Logs/Homebrew/powerlevel9k... (131B)
Removing: /Users/alice/Library/Logs/Homebrew/gettext... (64B)
Removing: /Users/alice/Library/Logs/Homebrew/pcre2... (64B)
Removing: /Users/alice/Library/Logs/Homebrew/pcre... (64B)
Removing: /Users/alice/Library/Logs/Homebrew/zsh... (64B)
Removing: /Users/alice/Library/Logs/Homebrew/helm... (64B)
Removing: /Users/alice/Library/Logs/Homebrew/git... (64B)
Pruned 0 symbolic links and 2 directories from /usr/local
==> Caveats
==> openssl@1.1
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /usr/local/etc/openssl@1.1/certs

and run
  /usr/local/opt/openssl@1.1/bin/c_rehash

openssl@1.1 is keg-only, which means it was not symlinked into /usr/local,
because macOS provides LibreSSL.

If you need to have openssl@1.1 first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc

For compilers to find openssl@1.1 you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"

For pkg-config to find openssl@1.1 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"

==> readline
readline is keg-only, which means it was not symlinked into /usr/local,
because macOS provides BSD libedit.

For compilers to find readline you may need to set:
  export LDFLAGS="-L/usr/local/opt/readline/lib"
  export CPPFLAGS="-I/usr/local/opt/readline/include"

For pkg-config to find readline you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/readline/lib/pkgconfig"

==> sqlite
sqlite is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have sqlite first in your PATH run:
  echo 'export PATH="/usr/local/opt/sqlite/bin:$PATH"' >> ~/.zshrc

For compilers to find sqlite you may need to set:
  export LDFLAGS="-L/usr/local/opt/sqlite/lib"
  export CPPFLAGS="-I/usr/local/opt/sqlite/include"

For pkg-config to find sqlite you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/sqlite/lib/pkgconfig"

==> python@3.8
Python has been installed as
  /usr/local/opt/python@3.8/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
  /usr/local/opt/python@3.8/libexec/bin

You can install Python packages with
  /usr/local/opt/python@3.8/bin/pip3 install <package>
They will install into the site-package directory
  /usr/local/lib/python3.8/site-packages

See: https://docs.brew.sh/Homebrew-and-Python

python@3.8 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have python@3.8 first in your PATH run:
  echo 'export PATH="/usr/local/opt/python@3.8/bin:$PATH"' >> ~/.zshrc

For compilers to find python@3.8 you may need to set:
  export LDFLAGS="-L/usr/local/opt/python@3.8/lib"

For pkg-config to find python@3.8 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/python@3.8/lib/pkgconfig"

위와 같이 실행이 되고있는것을 확인 할 수 있다.

az login

로그인 command 를 치면 마쏘 azure 로긴 페이지가 뜨면서 로그인 하라고 나온다.

그럼 로긴 하면된다.

버전도 확인해 보자

% az --version
azure-cli                         2.17.1

core                              2.17.1
telemetry                          1.0.6

Python location '/usr/local/Cellar/azure-cli/2.17.1/libexec/bin/python'
Extensions directory '/Users/alice/.azure/cliextensions'

Python (Darwin) 3.8.7 (default, Jan  8 2021, 07:24:52) 
[Clang 12.0.0 (clang-1200.0.32.28)]

Legal docs and information: aka.ms/AzureCliLegal


Your CLI is up-to-date.

Please let us know how we are doing: https://aka.ms/azureclihats
and let us know if you're interested in trying out our newest features: https://aka.ms/CLIUXstudy

특정한 단어의 설명을 찾고 싶다면 az find cmd 를 이용한다.

나는 blob 에 대해 검색해보고자 한다.

% az find blob

Finding examples...

Here are the most common ways to use [blob]: 

Restore blobs in two specified blob ranges. For examples, (container1/blob1, container2/blob2) and (container2/blob3..container2/blob4).
az storage blob restore --account-name mystorageaccount --resource-group MyResourceGroup --time-to-restore 2020-02-27T03:59:59Z --blob-range container1/blob1 container2/blob2 --blob-range container2/blob3 container2/blob4

Restore blobs in the specified blob range.
time=`date -u -d "30 minutes" '+%Y-%m-%dT%H:%MZ'`
az storage blob restore --account-name mystorageaccount -g MyResourceGroup -t $time -r container0/blob1 container0/blob2

Sync blobs recursively to a storage blob container. (autogenerated)
az storage blob sync --account-name mystorageccount --container mycontainer --source "path/to/directory"

Please let us know how we are doing: https://aka.ms/azureclihats

help cmd 를 통해 명령어 옵셥들도 확인이 가능하다.

% az storage blob --help


Group
    az storage blob : Manage object storage for unstructured data (blobs).
        Please specify one of the following authentication parameters for your commands: --auth-
        mode, --account-key, --connection-string, --sas-token. You also can use corresponding
        environment variables to store your authentication credentials, e.g. AZURE_STORAGE_KEY,
        AZURE_STORAGE_CONNECTION_STRING and AZURE_STORAGE_SAS_TOKEN.

Subgroups:
    copy               : Manage blob copy operations. Use `az storage blob show` to check the status
                         of the blobs.
    incremental-copy   : Manage blob incremental copy operations.
    lease              : Manage storage blob leases.
    metadata           : Manage blob metadata.
    service-properties : Manage storage blob service properties.

Commands:
    delete             : Mark a blob or snapshot for deletion.
    delete-batch       : Delete blobs from a blob container recursively.
    download           : Downloads a blob to a file path, with automatic chunking and progress
                         notifications.
    download-batch     : Download blobs from a blob container recursively.
    exists             : Check for the existence of a blob in a container.
    generate-sas       : Generate a shared access signature for the blob.
    list               : List blobs in a given container.
    query    [Preview] : Enable users to select/project on blob or blob snapshot data by
                         providing simple query expressions.
    restore  [Preview] : Restore blobs in the specified blob ranges.
    set-tier           : Set the block or page tiers on the blob.
    show               : Get the details of a blob.
    snapshot           : Creates a read-only snapshot of a blob.
    sync     [Preview] : Sync blobs recursively to a storage blob container.
    undelete           : The undelete Blob operation restores the contents and metadata of soft
                         deleted blob or snapshot.
    update             : Sets system properties on the blob.
    upload             : Upload a file to a storage blob.
    upload-batch       : Upload files from a local directory to a blob container.
    url                : Create the url to access a blob.

For more specific examples, use: az find "az storage blob"

Please let us know how we are doing: https://aka.ms/azureclihats

Azure Resource Group 을 만드는 cmd 는 아래와 같다.

<name> 과 <location> 을 실제 값으로 넣어주면 된다.

az group create --name <name> --location <location>

group 을 확인하는 cmd

az group list
az group list --output table

 

 

내용이 도움이 되셨다면 블로그 구독하기 부탁드리겠습니다.

* 이 글의 모든 저작권은 aliceintr에 있으며 무단 배포 및 사용은 자제해 주시기 바랍니다. *

 

 

 

 

반응형