티스토리 뷰

Azure 기타

Linux Azure CLI 설치

zerobig-k8s 2019. 11. 20. 08:42

<출처>

https://docs.microsoft.com/ko-kr/cli/azure/install-azure-cli-apt?view=azure-cli-latest

https://docs.microsoft.com/ko-kr/cli/azure/install-azure-cli-yum?view=azure-cli-latest

 

 

 

1. Ubuntu16.04

 

하나의 명령을 사용하여 설치

 

한 번에 모든 설치 명령을 실행하는 스크립트를 제공하고 유지 관리한다. curl을 사용하고 bash로 직접 파이프하여 실행하거나 스크립트를 파일로 다운로드하여 실행 전에 검사한다.

# 중요 #

이 스크립트는 Ubuntu 16.04+ 및 Debian 8+에서만 검증되었습니다. 다른 배포에는 작동하지 않을 수 있다. 

 

curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
Welcome to Ubuntu 16.04.6 LTS (GNU/Linux 4.15.0-1061-azure x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

0 packages can be updated.
0 updates are security updates.



The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.


To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

zerobig@zerovmu1604:~$ 
zerobig@zerovmu1604:~$ curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
apt-get update
Hit:1 http://azure.archive.ubuntu.com/ubuntu xenial InRelease
Get:2 http://azure.archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
Get:3 http://azure.archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]
Get:4 http://azure.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages [7,532 kB]
Get:5 http://azure.archive.ubuntu.com/ubuntu xenial/universe Translation-en [4,354 kB]                            
Get:6 http://security.ubuntu.com/ubuntu xenial-security InRelease [109 kB]           
Get:7 http://azure.archive.ubuntu.com/ubuntu xenial/multiverse amd64 Packages [144 kB]            
Get:8 http://azure.archive.ubuntu.com/ubuntu xenial/multiverse Translation-en [106 kB]
Get:9 http://azure.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [1,056 kB]
Get:10 http://azure.archive.ubuntu.com/ubuntu xenial-updates/main Translation-en [408 kB]
Get:11 http://azure.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [769 kB]
Get:12 http://azure.archive.ubuntu.com/ubuntu xenial-updates/universe Translation-en [322 kB]
Get:13 http://azure.archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages [16.8 kB]
Get:14 http://azure.archive.ubuntu.com/ubuntu xenial-updates/multiverse Translation-en [8,468 B]
Get:15 http://azure.archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages [7,280 B] 
Get:16 http://azure.archive.ubuntu.com/ubuntu xenial-backports/main Translation-en [4,456 B]
Get:17 http://azure.archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages [8,064 B]
Get:18 http://azure.archive.ubuntu.com/ubuntu xenial-backports/universe Translation-en [4,328 B]
Get:19 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [770 kB]        
Get:20 http://security.ubuntu.com/ubuntu xenial-security/main Translation-en [297 kB]
Get:21 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [463 kB]
Get:22 http://security.ubuntu.com/ubuntu xenial-security/universe Translation-en [190 kB]                                
Get:23 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages [5,728 B]                             
Get:24 http://security.ubuntu.com/ubuntu xenial-security/multiverse Translation-en [2,708 B]                             
Fetched 16.8 MB in 9s (1,852 kB/s)                                                                                       
Reading package lists... Done
apt-get install -y apt-transport-https lsb-release gnupg curl
Reading package lists... Done
Building dependency tree       
Reading state information... Done
apt-transport-https is already the newest version (1.2.32).
curl is already the newest version (7.47.0-1ubuntu2.14).
gnupg is already the newest version (1.4.20-1ubuntu3.3).
lsb-release is already the newest version (9.20160110ubuntu0.2).
The following package was automatically installed and is no longer required:
  grub-pc-bin
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 16 not upgraded.
set +v
curl -sL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/microsoft.asc.gpg
set +v
CLI_REPO=$(lsb_release -cs)
lsb_release -cs
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ ${CLI_REPO} main" \
    > /etc/apt/sources.list.d/azure-cli.list
apt-get update
Hit:1 http://azure.archive.ubuntu.com/ubuntu xenial InRelease
Hit:2 http://azure.archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:3 http://azure.archive.ubuntu.com/ubuntu xenial-backports InRelease
Get:4 https://packages.microsoft.com/repos/azure-cli xenial InRelease [3,964 B]
Get:5 https://packages.microsoft.com/repos/azure-cli xenial/main amd64 Packages [8,246 B]
Hit:6 http://security.ubuntu.com/ubuntu xenial-security InRelease
Fetched 12.2 kB in 0s (22.5 kB/s)
Reading package lists... Done
set +v
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  grub-pc-bin
Use 'sudo apt autoremove' to remove it.
The following NEW packages will be installed:
  azure-cli
0 upgraded, 1 newly installed, 0 to remove and 16 not upgraded.
Need to get 46.6 MB of archives.
After this operation, 466 MB of additional disk space will be used.
Get:1 https://packages.microsoft.com/repos/azure-cli xenial/main amd64 azure-cli all 2.0.76-1~xenial [46.6 MB]
Fetched 46.6 MB in 1s (32.2 MB/s)    
Selecting previously unselected package azure-cli.
(Reading database ... 53886 files and directories currently installed.)
Preparing to unpack .../azure-cli_2.0.76-1~xenial_all.deb ...
Unpacking azure-cli (2.0.76-1~xenial) ...
Setting up azure-cli (2.0.76-1~xenial) ...
zerobig@zerovmu1604:~$ az

Welcome to Azure CLI!
---------------------
Use `az -h` to see available commands or go to https://aka.ms/cli.

Telemetry
---------
The Azure CLI collects usage data in order to improve your experience.
The data is anonymous and does not include commandline argument values.
The data is collected by Microsoft.

You can change your telemetry settings with `az configure`.


     /\
    /  \    _____   _ _  ___ _
   / /\ \  |_  / | | | \'__/ _\
  / ____ \  / /| |_| | | |  __/
 /_/    \_\/___|\__,_|_|  \___|


Welcome to the cool new Azure CLI!

Use `az --version` to display the current version.
Here are the base commands:

    account           : Manage Azure subscription information.
    acr               : Manage private registries with Azure Container Registries.
    ad                : Manage Azure Active Directory Graph entities needed for Role Based Access
                       Control.
    advisor           : Manage Azure Advisor.
    aks               : Manage Azure Kubernetes Services.
    ams               : Manage Azure Media Services resources.
    apim              : Manage Azure API Management services.
    appconfig         : Manage App Configurations.
    appservice        : Manage App Service plans.
    backup            : Manage Azure Backups.
    batch             : Manage Azure Batch.
    billing           : Manage Azure Billing.
    bot               : Manage Microsoft Azure Bot Service.
    cache             : Commands to manage CLI objects cached using the `--defer` argument.
    cdn               : Manage Azure Content Delivery Networks (CDNs).
    cloud             : Manage registered Azure clouds.
    cognitiveservices : Manage Azure Cognitive Services accounts.
    configure         : Manage Azure CLI configuration. This command is interactive.
    consumption       : Manage consumption of Azure resources.
    container         : Manage Azure Container Instances.
    cosmosdb          : Manage Azure Cosmos DB database accounts.
    deployment        : Manage Azure Resource Manager deployments at subscription scope.
    deploymentmanager : Create and manage rollouts for your service.
    disk              : Manage Azure Managed Disks.
    dla               : Manage Data Lake Analytics accounts, jobs, and catalogs.
    dls               : Manage Data Lake Store accounts and filesystems.
    dms               : Manage Azure Data Migration Service (DMS) instances.
    eventgrid         : Manage Azure Event Grid topics, event subscriptions, domains and domain
                       topics.
    eventhubs         : Manage Azure Event Hubs namespaces, eventhubs, consumergroups and geo
                       recovery configurations - Alias.
    extension         : Manage and update CLI extensions.
    feature           : Manage resource provider features.
    feedback          : Send feedback to the Azure CLI Team!
    find              : I'm an AI robot, my advice is based on our Azure documentation as well as
                       the usage patterns of Azure CLI and Azure ARM users. Using me improves Azure
                       products and documentation.
    functionapp       : Manage function apps. To install the Azure Functions Core tools see
                       https://github.com/Azure/azure-functions-core-tools.
    group             : Manage resource groups and template deployments.
    hdinsight         : Manage HDInsight resources.
    identity          : Managed Service Identities.
    image             : Manage custom virtual machine images.
    interactive       : Start interactive mode. Installs the Interactive extension if not installed
                       already.
    iot               : Manage Internet of Things (IoT) assets.
    iotcentral        : Manage IoT Central assets.
    keyvault          : Manage KeyVault keys, secrets, and certificates.
    kusto             : Manage Azure Kusto resources.
    lab               : Manage Azure DevTest Labs.
    lock              : Manage Azure locks.
    login             : Log in to Azure.
    logout            : Log out to remove access to Azure subscriptions.
    managedapp        : Manage template solutions provided and maintained by Independent Software
                       Vendors (ISVs).
    managedservices   : Manage the registration assignments and definitions in Azure.
    maps              : Manage Azure Maps.
    mariadb           : Manage Azure Database for MariaDB servers.
    monitor           : Manage the Azure Monitor Service.
    mysql             : Manage Azure Database for MySQL servers.
    netappfiles       : Manage Azure NetApp Files (ANF) Resources.
    network           : Manage Azure Network resources.
    openshift         : Manage Azure Red Hat OpenShift Services.
    policy            : Manage resource policies.
    postgres          : Manage Azure Database for PostgreSQL servers.
    ppg               : Manage Proximity Placement Groups.
    provider          : Manage resource providers.
    redis             : Manage dedicated Redis caches for your Azure applications.
    relay             : Manage Azure Relay Service namespaces, WCF relays, hybrid connections, and
                       rules.
    reservations      : Manage Azure Reservations.
    resource          : Manage Azure resources.
    rest              : Invoke a custom request.
    role              : Manage user roles for access control with Azure Active Directory and service
                       principals.
    search            : Manage Azure Search services, admin keys and query keys.
    security          : Manage your security posture with Azure Security Center.
    servicebus        : Manage Azure Service Bus namespaces, queues, topics, subscriptions, rules
                       and geo-disaster recovery configuration alias.
    sf                : Manage and administer Azure Service Fabric clusters.
    sig               : Manage shared image gallery.
    signalr           : Manage Azure SignalR Service.
    snapshot          : Manage point-in-time copies of managed disks, native blobs, or other
                       snapshots.
    sql               : Manage Azure SQL Databases and Data Warehouses.
    storage           : Manage Azure Cloud Storage resources.
    tag               : Manage resource tags.
    vm                : Manage Linux or Windows virtual machines.
    vmss              : Manage groupings of virtual machines in an Azure Virtual Machine Scale Set
                       (VMSS).
    webapp            : Manage web apps.

 

az 명령을 사용하여 Azure CLI를 실행합니다. 로그인하려면, az login 명령을 사용한다.

 

1. login 명령을 실행한다.

 

az login
zerobig@zerovmu1604:~$ az login
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code GZ4DE7SSW to authenticate.

 

 

2. CLI는 기본 브라우저를 열 수 있으면 기본 브라우저를 열고 Azure 로그인 페이지를 로드합니다.

그렇지 않으면 https://aka.ms/devicelogin에서 브라우저 페이지를 열고 터미널에 표시된 권한 부여 코드를 입력합니다.

3, 브라우저에서 계정 자격 증명으로 로그인합니다.

다른 인증 방법에 대한 자세한 내용은 Azure CLI로 로그인을 참조하세요.

zerobig@zerovmu1604:~$ az login
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code GZ4DE7SSW to authenticate.
[
  {
    "cloudName": "AzureCloud",
    "id": "f8764f39-01ee-4631-9941-77b286ed971b",
    "isDefault": true,
    "name": "Visual Studio Enterprise 201907",
    "state": "Enabled",
    "tenantId": "917bfe84-0ca6-488d-ad3a-236e41ceafe9",
    "user": {
      "name": "zerobig.kim@gmail.com",
      "type": "user"
    }
  }
]

 

 

 

2. CentOS75

 

설치

 

1. Microsoft 리포지토리 키를 가져옵니다.

 

sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
[zerobig@zerovmc75 ~]$ sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc

 

2. 로컬 azure-cli 리포지토리 정보를 만듭니다.

 

sudo sh -c 'echo -e "[azure-cli]
name=Azure CLI
baseurl=https://packages.microsoft.com/yumrepos/azure-cli
enabled=1
gpgcheck=1
gpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/azure-cli.repo'
[zerobig@zerovmc75 ~]$ sudo sh -c 'echo -e "[azure-cli]
> name=Azure CLI
> baseurl=https://packages.microsoft.com/yumrepos/azure-cli
> enabled=1
> gpgcheck=1
> gpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/azure-cli.repo'

 

3. yum install 명령을 사용하여 설치됩니다.

 

sudo yum install azure-cli
[zerobig@zerovmc75 ~]$ sudo yum install azure-cli
Loaded plugins: fastestmirror, langpacks
Determining fastest mirrors
azure-cli                                                                                          | 2.9 kB  00:00:00     
base                                                                                               | 3.1 kB  00:00:00     
extras                                                                                             | 2.5 kB  00:00:00     
openlogic                                                                                          | 2.9 kB  00:00:00     
updates                                                                                            | 2.6 kB  00:00:00     
(1/6): base/7/x86_64/group_gz                                                                      | 165 kB  00:00:00     
(2/6): extras/7/x86_64/primary_db                                                                  | 153 kB  00:00:00     
(3/6): openlogic/7/x86_64/primary_db                                                               | 100 kB  00:00:00     
(4/6): updates/7/x86_64/primary_db                                                                 | 2.8 MB  00:00:00     
(5/6): azure-cli/primary_db                                                                        |  48 kB  00:00:00     
(6/6): base/7/x86_64/primary_db                                                                    | 6.0 MB  00:00:00     
Resolving Dependencies
--> Running transaction check
---> Package azure-cli.x86_64 0:2.0.76-1.el7 will be installed
--> Processing Dependency: python-virtualenv for package: azure-cli-2.0.76-1.el7.x86_64

 

az 명령을 사용하여 Azure CLI를 실행합니다. 로그인하려면, az login 명령을 사용합니다.

 

1. login 명령을 실행합니다.

 

az login
[zerobig@zerovmc75 ~]$ az login
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code G6ZWXYBV9 to authenticate.

 

2. CLI는 기본 브라우저를 열 수 있으면 기본 브라우저를 열고 Azure 로그인 페이지를 로드합니다.

그렇지 않으면 https://aka.ms/devicelogin에서 브라우저 페이지를 열고 터미널에 표시된 권한 부여 코드를 입력합니다.

3. 브라우저에서 계정 자격 증명으로 로그인합니다.

[zerobig@zerovmc75 ~]$ az login
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code G6ZWXYBV9 to authenticate.
[
  {
    "cloudName": "AzureCloud",
    "id": "2e5d848e-8dfe-42ae-95a5-fd25ae915bcd",
    "isDefault": true,
    "name": "Visual Studio Enterprise 2019",
    "state": "Enabled",
    "tenantId": "54a472fb-1510-4554-922c-fe808f9e6e64",
    "user": {
      "name": "zerobig.devops@gmail.com",
      "type": "user"
    }
  }
]
[zerobig@zerovmc75 ~]$ 

 

다른 인증 방법에 대한 자세한 내용은 Azure CLI로 로그인을 참조하세요.

[zerobig@zerovmc75 ~]$ az 

Welcome to Azure CLI!
---------------------
Use `az -h` to see available commands or go to https://aka.ms/cli.

Telemetry
---------
The Azure CLI collects usage data in order to improve your experience.
The data is anonymous and does not include commandline argument values.
The data is collected by Microsoft.

You can change your telemetry settings with `az configure`.


     /\
    /  \    _____   _ _  ___ _
   / /\ \  |_  / | | | \'__/ _\
  / ____ \  / /| |_| | | |  __/
 /_/    \_\/___|\__,_|_|  \___|


Welcome to the cool new Azure CLI!

Use `az --version` to display the current version.
Here are the base commands:

    account           : Manage Azure subscription information.
    acr               : Manage private registries with Azure Container Registries.
    ad                : Manage Azure Active Directory Graph entities needed for Role Based Access
                       Control.
    advisor           : Manage Azure Advisor.
    aks               : Manage Azure Kubernetes Services.
    ams               : Manage Azure Media Services resources.
    apim              : Manage Azure API Management services.
    appconfig         : Manage App Configurations.
    appservice        : Manage App Service plans.
    backup            : Manage Azure Backups.
    batch             : Manage Azure Batch.
    billing           : Manage Azure Billing.
    bot               : Manage Microsoft Azure Bot Service.
    cache             : Commands to manage CLI objects cached using the `--defer` argument.
    cdn               : Manage Azure Content Delivery Networks (CDNs).
    cloud             : Manage registered Azure clouds.
    cognitiveservices : Manage Azure Cognitive Services accounts.
    configure         : Manage Azure CLI configuration. This command is interactive.
    consumption       : Manage consumption of Azure resources.
    container         : Manage Azure Container Instances.
    cosmosdb          : Manage Azure Cosmos DB database accounts.
    deployment        : Manage Azure Resource Manager deployments at subscription scope.
    deploymentmanager : Create and manage rollouts for your service.
    disk              : Manage Azure Managed Disks.
    dla               : Manage Data Lake Analytics accounts, jobs, and catalogs.
    dls               : Manage Data Lake Store accounts and filesystems.
    dms               : Manage Azure Data Migration Service (DMS) instances.
    eventgrid         : Manage Azure Event Grid topics, event subscriptions, domains and domain
                       topics.
    eventhubs         : Manage Azure Event Hubs namespaces, eventhubs, consumergroups and geo
                       recovery configurations - Alias.
    extension         : Manage and update CLI extensions.
    feature           : Manage resource provider features.
    feedback          : Send feedback to the Azure CLI Team!
    find              : I'm an AI robot, my advice is based on our Azure documentation as well as
                       the usage patterns of Azure CLI and Azure ARM users. Using me improves Azure
                       products and documentation.
    functionapp       : Manage function apps. To install the Azure Functions Core tools see
                       https://github.com/Azure/azure-functions-core-tools.
    group             : Manage resource groups and template deployments.
    hdinsight         : Manage HDInsight resources.
    identity          : Managed Service Identities.
    image             : Manage custom virtual machine images.
    interactive       : Start interactive mode. Installs the Interactive extension if not installed
                       already.
    iot               : Manage Internet of Things (IoT) assets.
    iotcentral        : Manage IoT Central assets.
    keyvault          : Manage KeyVault keys, secrets, and certificates.
    kusto             : Manage Azure Kusto resources.
    lab               : Manage Azure DevTest Labs.
    lock              : Manage Azure locks.
    login             : Log in to Azure.
    logout            : Log out to remove access to Azure subscriptions.
    managedapp        : Manage template solutions provided and maintained by Independent Software
                       Vendors (ISVs).
    managedservices   : Manage the registration assignments and definitions in Azure.
    maps              : Manage Azure Maps.
    mariadb           : Manage Azure Database for MariaDB servers.
    monitor           : Manage the Azure Monitor Service.
    mysql             : Manage Azure Database for MySQL servers.
    netappfiles       : Manage Azure NetApp Files (ANF) Resources.
    network           : Manage Azure Network resources.
    openshift         : Manage Azure Red Hat OpenShift Services.
    policy            : Manage resource policies.
    postgres          : Manage Azure Database for PostgreSQL servers.
    ppg               : Manage Proximity Placement Groups.
    provider          : Manage resource providers.
    redis             : Manage dedicated Redis caches for your Azure applications.
    relay             : Manage Azure Relay Service namespaces, WCF relays, hybrid connections, and
                       rules.
    reservations      : Manage Azure Reservations.
    resource          : Manage Azure resources.
    rest              : Invoke a custom request.
    role              : Manage user roles for access control with Azure Active Directory and service
                       principals.
    search            : Manage Azure Search services, admin keys and query keys.
    security          : Manage your security posture with Azure Security Center.
    servicebus        : Manage Azure Service Bus namespaces, queues, topics, subscriptions, rules
                       and geo-disaster recovery configuration alias.
    sf                : Manage and administer Azure Service Fabric clusters.
    sig               : Manage shared image gallery.
    signalr           : Manage Azure SignalR Service.
    snapshot          : Manage point-in-time copies of managed disks, native blobs, or other
                       snapshots.
    sql               : Manage Azure SQL Databases and Data Warehouses.
    storage           : Manage Azure Cloud Storage resources.
    tag               : Manage resource tags.
    vm                : Manage Linux or Windows virtual machines.
    vmss              : Manage groupings of virtual machines in an Azure Virtual Machine Scale Set
                       (VMSS).
    webapp            : Manage web apps.
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2025/01   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함