Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Un-escaped JSON in AzureServiceAuth\tokenprovider.json #397

Open
scottmcm opened this issue Aug 14, 2023 · 3 comments
Open

Un-escaped JSON in AzureServiceAuth\tokenprovider.json #397

scottmcm opened this issue Aug 14, 2023 · 3 comments

Comments

@scottmcm
Copy link

scottmcm commented Aug 14, 2023

Describe the Bug

Running my Net6 project via docker compose in VS, DefaultAzureCredential fails with

[Informational] Azure-Identity: VisualStudioCredential.GetToken invoked. Scopes: [ https://storage.azure.com/.default ] ParentRequestId: 2109dca0-a2c9-4e44-942f-bcddaa4989f7
[Informational] Azure-Identity: VisualStudioCredential.GetToken was unable to retrieve an access token. Scopes: [ https://storage.azure.com/.default ] ParentRequestId: 2109dca0-a2c9-4e44-942f-bcddaa4989f7 Exception: Azure.Identity.CredentialUnavailableException (0x80131500): File found at "C:\Users\ContainerAdministrator\AppData\Local\.IdentityService\AzureServiceAuth\tokenprovider.json" isn't a valid JSON file
 ---> System.Text.Json.JsonReaderException (0x80131500): 'T' is an invalid escapable character within a JSON string. The string should be correctly escaped. LineNumber: 0 | BytePositionInLine: 111.

in the logging I get from AzureEventSourceListener.CreateConsoleLogger().

Steps to Reproduce

The contents of that file:
image

{"TokenProviders":[{"Path":"C:\\Program Files\\dotnet\\dotnet.exe","Arguments":["--roll-forward", "Major", "C:\TokenService.Proxy\TokenService.Proxy.dll", "--client"],"Preference":0}]}

which the github highlighting agrees isn't valid JSON.

Other Information

This may be related to be upgrading to "Version 17.7.0" of VS, since I was able to get a credential before.

Output of docker version

Client:
 Cloud integration: v1.0.35-desktop+001
 Version:           24.0.5
 API version:       1.43
 Go version:        go1.20.6
 Git commit:        ced0996
 Built:             Fri Jul 21 20:36:24 2023
 OS/Arch:           windows/amd64
 Context:           default

Server: Docker Desktop 4.22.0 (117440)
 Engine:
  Version:          24.0.5
  API version:      1.43 (minimum version 1.24)
  Go version:       go1.20.6
  Git commit:       a61e2b4
  Built:            Fri Jul 21 20:35:10 2023
  OS/Arch:          windows/amd64
  Experimental:     false

Output of docker info

Toggle me!
Client:
 Version:    24.0.5
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.11.2-desktop.1
    Path:     C:\Program Files\Docker\cli-plugins\docker-buildx.exe
  compose: Docker Compose (Docker Inc.)
    Version:  v2.20.2-desktop.1
    Path:     C:\Program Files\Docker\cli-plugins\docker-compose.exe
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-dev.exe
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.20
    Path:     C:\Program Files\Docker\cli-plugins\docker-extension.exe
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v0.1.0-beta.6
    Path:     C:\Program Files\Docker\cli-plugins\docker-init.exe
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-sbom.exe
  scan: Docker Scan (Docker Inc.)
    Version:  v0.26.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-scan.exe
  scout: Command line tool for Docker Scout (Docker Inc.)
    Version:  0.20.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-scout.exe

Server:
 Containers: 2
  Running: 2
  Paused: 0
  Stopped: 0
 Images: 23
 Server Version: 24.0.5
 Storage Driver: windowsfilter
  Windows:
 Logging Driver: json-file
 Plugins:
  Volume: local
  Network: ics internal l2bridge l2tunnel nat null overlay private transparent
  Log: awslogs etwlogs fluentd gcplogs gelf json-file local logentries splunk syslog
 Swarm: inactive
 Default Isolation: hyperv
 Kernel Version: 10.0 22631 (22621.1.amd64fre.ni_release.220506-1250)
 Operating System: Microsoft Windows Version 23H2 (OS Build 22631.2129)
 OSType: windows
 Architecture: x86_64
 CPUs: 20
 Total Memory: 127.8GiB
 ID: 8b3a3a9f-d6b1-4cca-8042-35d7a5f69722
 Docker Root Dir: C:\ProgramData\Docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine
@NCarlsonMSFT
Copy link
Member

@scottmcm I believe this is already fixed in 17.8 Preview 1, can you try that?

@scottmcm
Copy link
Author

Confirmed this is a 17.7 issue; I downgraded to 17.6.5 and with no other changes it works again

[Informational] Azure-Identity: VisualStudioCredential.GetToken invoked. Scopes: [ https://storage.azure.com/.default ] ParentRequestId: 6d7cdbd4-f3de-4d4a-8b0e-fe85c8d20266
[Informational] Azure-Identity: VisualStudioCredential.GetToken succeeded. Scopes: [ https://storage.azure.com/.default ] ParentRequestId: 6d7cdbd4-f3de-4d4a-8b0e-fe85c8d20266 ExpiresOn: 2023-08-15T00:04:29.0000000+00:00
[Informational] Azure-Identity: DefaultAzureCredential credential selected: Azure.Identity.VisualStudioCredential

@NCarlsonMSFT thanks, I'll give that a shot.

@scottmcm
Copy link
Author

Upgraded to VS "Version 17.8.0 Preview 1.0", and it's fixed
image

And logs confirm it got the token successfully

[Informational] Azure-Identity: VisualStudioCredential.GetToken invoked. Scopes: [ https://storage.azure.com/.default ] ParentRequestId: b9e86541-8825-447e-a704-81052496007f
[Informational] Azure-Identity: VisualStudioCredential.GetToken succeeded. Scopes: [ https://storage.azure.com/.default ] ParentRequestId: b9e86541-8825-447e-a704-81052496007f ExpiresOn: 2023-08-15T01:21:05.5611121+00:00
[Informational] Azure-Identity: DefaultAzureCredential credential selected: Azure.Identity.VisualStudioCredential
[Informational] Azure-Identity: DefaultAzureCredential.GetToken succeeded. Scopes: [ https://storage.azure.com/.default ] ParentRequestId: b9e86541-8825-447e-a704-81052496007f ExpiresOn: 2023-08-15T01:21:05.5611121+00:00

If you're planning a 17.7.1 it would be great if it could include a fix for this, otherwise feel free to close this and I'll just tell my coworkers not to update to 17.7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants