@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"
}
md5-39518d767445d46d94f09053f5401b09
> az acr show-usage
{
"value": [
{
"currentValue": 0,
"limit": 107374182400,
"name": "Size",
"unit": "Bytes"
},
{
"currentValue": 0,
"limit": 10,
"name": "Webhooks",
"unit": "Count"
}
]
}
md5-39518d767445d46d94f09053f5401b09
> az acr repository list
[]
md5-e0426129fe8cd5a919836f0a56714b38
> docker login shizhacr.azurecr.io
Username (shizhacr): shizhacr
Password:
Login Succeeded
md5-bfb6729cd7ffd344965ce8c264b4243c
> az acr login
Incorrect function.
md5-143036a19cc0d0d89e9dbe9cf56bf02a
> 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
Same problem here, after the az acr login I receive "incorrect function"
@derekbekoe @troydai @tjprescott I didn't find anything special in our module that could cause this and the error message is too ambiguous to know the exact root cause. It is affecting CLI installed with the recent MSI installer (installation through pip or docker container both work). I will try to generate the installer locally and run to see what is going on, but at the same time, can any of you suggest what the issue might be? Thanks. /cc @SajayAntony
Doing a general search online, the error message is coming directly from Windows.
Would be good to know the exact Windows version being used so the error can be reproduced.
https://stackoverflow.com/a/42778990/1952133
Also, doesn't az acr login require --name? I don't see that mentioned above.
acr login does require --name and I think @shiweiz just removed all the parameters in all the above examples. I tried this on a fresh Windows 10 machine without any problem so knowing the OS version would be helpful.
@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:

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.
I had the same issue. I believe it was because I wasn't running the cmd shell as admin.
I'm getting this error too, even in an Admin window of cmd
Using --verbose and --debug shows:
...
urllib3.connectionpool : Starting new HTTPS connection (1): REMOVED.azurecr.io
urllib3.connectionpool : https://REMOVED.azurecr.io:443 "POST /oauth2/exchange HTTP/1.1" 200 None
Incorrect function.
Application event 'Application.TransformResults' with event data {'event_data': {'result': None}}
Application event 'Application.FilterResults' with event data {'event_data': {'result': None}}
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.`
@djyou I suspect the token length is still an issue? Not fix for me, installed everything fresh.
@Plasma Token length issue hasn't been fixed yet. https://github.com/Azure/azure-cli/issues/4843 is the issue that is tracking the fix.
executing in a regular powershell console (not ConEmu) worked for me
PowerShell console works for me too. I was getting this error with ConEmu, thanks @cjeffers !
ConEmu, Cmd, PowerShell (admin or not)... nothing works.
Error saving credentials: error storing credentials - err: exit status 1, out: The stub received bad data.
@brugos can I know the version of the Azure CLI you're using?
This is the issue https://github.com/Azure/azure-cli/issues/4843 that was tracking this error. This is an OS issue that a temporary workaround was added (to disable wincred) in version 2.0.19 or later.
For me, the same situation in ConEmu CMD - doesn't work.
Standard console PowerShell as admin works correctly
Same here. It doesn't work on ConEmu CMD, it works with standard CMD.EXE
@djyou , it worked for me after updating az cli from 2.0.22 to 2.0.39
Most helpful comment
PowerShell console works for me too. I was getting this error with ConEmu, thanks @cjeffers !