microsoft / vscode-docker

Docker Extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker
Other
1.18k stars 508 forks source link

An exception occurred in the link China ACR in the docker extension #4287

Closed yzj0 closed 2 months ago

yzj0 commented 2 months ago

Type: Bug

install docker extension and use registries to connect the azure container registries in china cloud use azure china account to login,error code:400 will appear image

Extension version: 1.29.0 VS Code version: Code 1.88.1 (e170252f762678dec6ca2cc69aba1570769a5d39, 2024-04-10T17:41:02.734Z) OS version: Windows_NT x64 10.0.19045 Modes:

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i5-10500 CPU @ 3.10GHz (12 x 3096)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|undefined| |Memory (System)|31.75GB (14.20GB free)| |Process Argv|--crash-reporter-id 1811427d-cbc3-4f6d-8e2f-bdbb886410e3| |Screen Reader|no| |VM|67%|
A/B Experiments ``` vsliv368cf:30146710 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscorecescf:30445987 vscod805cf:30301675 binariesv615:30325510 vsaa593:30376534 py29gd2263:31024239 c4g48928:30535728 azure-dev_surveyone:30548225 a9j8j154:30646983 962ge761:30959799 pythongtdpath:30769146 welcomedialog:30910333 pythonidxpt:30866567 pythonnoceb:30805159 asynctok:30898717 pythontestfixt:30902429 pythonregdiag2:30936856 pyreplss1:30897532 pythonmypyd1:30879173 pythoncet0:30885854 h48ei257:31000450 pythontbext0:30879054 accentitlementsc:30995553 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 d34g3935:30971562 fegfb526:30981948 bg6jg535:30979843 ccp2r6:30993542 dsvsc020:30976470 pythonait:31006305 jchc7451:30973076 gee8j676:31009558 dsvsc021:30996838 bdiig495:31013172 pythoncenvpt:31022790 ```
bwateratmsft commented 2 months ago

I am able to reproduce.

@TylerLeonhardt do you know what this error means? "Consent between first party applications and first pary resources must be configured via preauthorization...."

TylerLeonhardt commented 2 months ago

Yeah whatever resource is being asked for has to be pre-authorized for first party apps. We basically have a list in our client id of this stuff. I'll DM you a link on what's required here.... but what scope are you requesting?

bwateratmsft commented 2 months ago

We're passing a bad scope to the auth provider. Need to investigate further.

bwateratmsft commented 2 months ago

Ok, got to the bottom.

  1. Passing undefined.default as a scope to the auth provider. Obviously not correct. An update to @microsoft/vscode-azext-azureauth fixes this.
  2. Not passing the endpoint to the container registry mgmt client, here: https://github.com/microsoft/vscode-docker/blob/43570039d74e9bbc9e07773350bd55d07d6a8e95/src/utils/azureUtils.ts#L23
  3. A side problem, we aren't using the lazy package getter for the above
yzj0 commented 2 months ago

@bwateratmsft How should I modify my environment to connect to ACR successfully?

bwateratmsft commented 2 months ago

Right now there is a bug in the extension that will prevent it from working. We're planning to release a fix for the bug sometime this week.

bwateratmsft commented 1 month ago

This should be fixed now in version Docker extension version 1.29.1.