azure-cli: az acr login failed

@djyou The login command failed in cmd:

> az acr login
Incorrect function.

Here is the configuration of default values:

> az configure

Welcome to the Azure CLI! This command will guide you through logging in and setting some default values.

Your settings can be found at C:\Users\shizh\.azure\config
Your current configuration is as follows:

[cloud]
name = AzureCloud

[core]
first_run = yes

[defaults]
group = shizhacrg
acr = shizhacr

Other commands seem working properly:

> az acr list
[
  {
    "adminUserEnabled": false,
    "creationDate": "2017-10-18T09:16:15.114582+00:00",
    "id": "/subscriptions/dfb63c8c-7c89-4ef8-af13-75c1d873c895/resourceGroups/shizhacrg/providers/Microsoft.ContainerRegistry/registries/shizhacr",
    "location": "eastus",
    "loginServer": "shizhacr.azurecr.io",
    "name": "shizhacr",
    "provisioningState": "Succeeded",
    "resourceGroup": "shizhacrg",
    "sku": {
      "name": "Managed_Standard",
      "tier": "Managed"
    },
    "storageAccount": null,
    "tags": {},
    "type": "Microsoft.ContainerRegistry/registries"
  }
]
> az acr show
{
  "adminUserEnabled": false,
  "creationDate": "2017-10-18T09:16:15.114582+00:00",
  "id": "/subscriptions/dfb63c8c-7c89-4ef8-af13-75c1d873c895/resourceGroups/shizhacrg/providers/Microsoft.ContainerRegistry/registries/shizhacr",
  "location": "eastus",
  "loginServer": "shizhacr.azurecr.io",
  "name": "shizhacr",
  "provisioningState": "Succeeded",
  "resourceGroup": "shizhacrg",
  "sku": {
    "name": "Managed_Standard",
    "tier": "Managed"
  },
  "storageAccount": null,
  "tags": {},
  "type": "Microsoft.ContainerRegistry/registries"
}
> az acr show-usage
{
  "value": [
    {
      "currentValue": 0,
      "limit": 107374182400,
      "name": "Size",
      "unit": "Bytes"
    },
    {
      "currentValue": 0,
      "limit": 10,
      "name": "Webhooks",
      "unit": "Count"
    }
  ]
}
> az acr repository list
[]

After enabling Admin user:

> docker login shizhacr.azurecr.io
Username (shizhacr): shizhacr
Password:
Login Succeeded

but still

> az acr login
Incorrect function.

Environment summary

Install Method (e.g. pip, interactive script, apt-get, Docker, MSI, edge build) / CLI version (az --version) / OS version / Shell Type (e.g. bash, cmd.exe, Bash on Windows)

> az --version
azure-cli (2.0.19)

acr (2.0.13)
acs (2.0.17)
appservice (0.1.18)
backup (1.0.1)
batch (3.1.5)
batchai (0.1.1)
billing (0.1.5)
cdn (0.0.9)
cloud (2.0.8)
cognitiveservices (0.1.8)
command-modules-nspkg (2.0.1)
component (2.0.7)
configure (2.0.11)
consumption (0.1.5)
container (0.1.11)
core (2.0.18)
cosmosdb (0.1.13)
dla (0.0.12)
dls (0.0.15)
eventgrid (0.1.4)
extension (0.0.4)
feedback (2.0.6)
find (0.2.7)
interactive (0.3.10)
iot (0.1.12)
keyvault (2.0.12)
lab (0.0.11)
monitor (0.0.10)
network (2.0.16)
nspkg (3.0.1)
profile (2.0.14)
rdbms (0.0.7)
redis (0.2.9)
resource (2.0.16)
role (2.0.13)
servicefabric (0.0.4)
sql (2.0.13)
storage (2.0.17)
vm (2.0.16)

Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\shizh\.azure\cliextensions'

Python (Windows) 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 17:54:52) [MSC v.1900 32 bit (Intel)]

Legal docs and information: aka.ms/AzureCliLegal

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 3
  • Comments: 19 (7 by maintainers)

Most upvoted comments

PowerShell console works for me too. I was getting this error with ConEmu, thanks @cjeffers !

executing in a regular powershell console (not ConEmu) worked for me

@derdanu @ddjyou --name is omitted in the above log. Actually, I use defaults (see az configure). I tried az acr login today again with the original CMD and PowerShell terminal, and it works. Therefore, I think there is something wrong with CMD and PowerShell running within the ConEmu software:

image

Since it works with the original CMD and PowerShell terminal, this issue can be closed now.

BTW, it is always good to show the system info for debugging purpose. Here is the system information with some identification information removed:

OS Name:                   Microsoft Windows 10 Enterprise
OS Version:                10.0.15063 N/A Build 15063
OS Manufacturer:           Microsoft Corporation
OS Configuration:          Member Workstation
OS Build Type:             Multiprocessor Free
Original Install Date:     10/11/2017, 5:03:46 PM
System Boot Time:          10/20/2017, 11:24:33 AM
System Manufacturer:       LENOVO
System Model:              3448B73
System Type:               x64-based PC
Processor(s):              1 Processor(s) Installed.
                           [01]: Intel64 Family 6 Model 58 Stepping 9 GenuineIntel ~2101 Mhz
BIOS Version:              LENOVO G6ET99WW (2.59 ), 11/19/2013
Windows Directory:         C:\windows
System Directory:          C:\windows\system32
Boot Device:               \Device\HarddiskVolume1
System Locale:             en-us;English (United States)
Input Locale:              en-us;English (United States)
Time Zone:                 (UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi
Total Physical Memory:     7,870 MB
Available Physical Memory: 930 MB
Virtual Memory: Max Size:  11,966 MB
Virtual Memory: Available: 3,455 MB
Virtual Memory: In Use:    8,511 MB
Page File Location(s):     C:\pagefile.sys
Hotfix(s):                 3 Hotfix(s) Installed.
                           [01]: KB4022405
                           [02]: KB4038806
                           [03]: KB4041676
Network Card(s):           3 NIC(s) Installed.
                           [01]: Intel(R) Centrino(R) Advanced-N 6205
                                 Connection Name: Wi-Fi
                                 DHCP Enabled:    Yes
                           [02]: Bluetooth Device (Personal Area Network)
                                 Connection Name: Bluetooth Network Connection
                                 Status:          Media disconnected
                           [03]: Hyper-V Virtual Ethernet Adapter
                                 Connection Name: vEthernet (DockerNAT)
                                 DHCP Enabled:    No
Hyper-V Requirements:      A hypervisor has been detected. Features required for Hyper-V will not be displayed.

In another window I see “Incorrect function” instead says:

Error saving credentials: error storing credentials - err: exit status 1, out: `The stub received bad data.`