Debugging Sandbox


I try to debug a sandbox (SaaS) - I add a new configuration in launch.json :

            "name": "Attach: Microsoft cloud sandbox",
            "type": "al",
            "request": "attach",
            "environmentType": "Sandbox",
            "environmentName": "sandbox",
            "breakOnError": true,
            "breakOnRecordWrite": false,
            "enableSqlInformationDebugger": true,
            "enableLongRunningSqlStatements": true,
            "longRunningSqlStatementsThreshold": 500,
            "numberOfSqlStatements": 10,
            "breakOnNext": "WebServiceClient"

do F5 to choose the attach server :

[2021-04-26 14:46:40.80] Starting a debug session using launch configuration 'Attach: Microsoft cloud sandbox'.
[2021-04-26 14:46:41.08] Authenticating...
[2021-04-26 14:46:41.59] Authenticated.
[2021-04-26 14:46:41.60] Authenticated as user 'xxx'. Please note that these credentials are cached. Clear the credentials cache to authenticate as another user.
[2021-04-26 14:46:41.60] Targeting Dynamics 365 Business Central.

Now I should publish the extension but this option is no more available - unless I Disconnect the attached server

What are I’m doing wrong ?

Edit : When doing CTRL - F5 I get the message “Running the contributed command: ‘al.publishExistingExtension’ failed.”

EnvironmentName should reflect the actual sandbox name you are connecting to.

You need to stop/disconnect the attached session, before you can use the same VSCode to publish. VSCode can only run one session/task at the time.