Forum Discussion

Broeks's avatar
Broeks
Helper II
1 year ago
Solved

Debugging in VSCode: Failed to get refresh token

Hello,

 

I'm developing my spark job definition in VSCode. I'm using the devcontainer provided by microsoft.

I've added the provided config code to my main.py file, however I'm getting a "Failed to get refresh token" when i debug my code.

I'm using the conda runtime 1.2.

 

I've tested my code and it works when running it in fabric as a SJD.

So I'm wondering what I'm doing wrong?

 

I've added a part of my debuglog to this post:

 

  • Hi Broeks,
    Thanks for reaching out to the Microsoft fabric community forum. Thank you nilendraFabric, for your valuable input regarding the issue

     

    After thoroughly reviewing the details you provided, I have identified few workarounds that may help resolve the issue. Please follow these steps:

     

    Please ensure that the Azure Account extension in VSCode is up to date. Issues with refresh tokens can sometimes be related to the extension version. Sign out and sign back in using the Azure Account extension to refresh credentials and resolve token-related issues.

     

    Make sure the fabric-synapse-runtime-1.2 Conda environment is properly activated in VSCode. Verify that the JAVA_HOME environment variable points to the correct JDK installation path, with OpenJDK 8 recommended to avoid compatibility issues.

     

    Check that the devcontainer configuration is correctly set up with all necessary dependencies and environment variables. Ensure the debugging configuration in the launch.json file is correctly set up for the Spark job, including the correct entry point and required arguments. If the issue persists, try clearing the cached credentials by removing the ~/.azuredatastudio/argv.json file, but note that this will remove all connections.


    If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.

     

    Thank you.

6 Replies

  • v-kpoloju-msft's avatar
    v-kpoloju-msft
    Community Support

    Hi Broeks,
    Thanks for reaching out to the Microsoft fabric community forum. Thank you nilendraFabric, for your valuable input regarding the issue

     

    After thoroughly reviewing the details you provided, I have identified few workarounds that may help resolve the issue. Please follow these steps:

     

    Please ensure that the Azure Account extension in VSCode is up to date. Issues with refresh tokens can sometimes be related to the extension version. Sign out and sign back in using the Azure Account extension to refresh credentials and resolve token-related issues.

     

    Make sure the fabric-synapse-runtime-1.2 Conda environment is properly activated in VSCode. Verify that the JAVA_HOME environment variable points to the correct JDK installation path, with OpenJDK 8 recommended to avoid compatibility issues.

     

    Check that the devcontainer configuration is correctly set up with all necessary dependencies and environment variables. Ensure the debugging configuration in the launch.json file is correctly set up for the Spark job, including the correct entry point and required arguments. If the issue persists, try clearing the cached credentials by removing the ~/.azuredatastudio/argv.json file, but note that this will remove all connections.


    If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.

     

    Thank you.

  • Hello Broeks 

     

    here are some pointers to start debugging 

    Ensure OpenJDK 8 is installed and configured (newer versions like JDK 21 cause compatibility issues)

     

    Verify `JAVA_HOME` environment variable points to the JDK 8 installation path.

    Confirm the `fabric-synapse-runtime-1.2` conda environment is properly activated in VS Code.

     

    • Broeks's avatar
      Broeks
      Helper II

      Hello nilendraFabric,
      Thanks for your response!
      I'm using the dev container provided by microsoft, this to ensure I don't have these issues.
      But I've checked these pointers and they are configured correctly:

       

      • nilendraFabric's avatar
        nilendraFabric
        Super User

        Seems like you are using your creds for SJD.

         

        could you try using service principal once

         

        Add these environment variables to your `.devcontainer/devcontainer.json`:

         

        If this too didn't work 

         

        Replace Fabric’s managed identity flow with explicit service principal credentials

         

         

        "remoteEnv": {
        "AZURE_TENANT_ID": "<tenant-id>",
        "AZURE_CLIENT_ID": "<client-id>",
        "AZURE_CLIENT_SECRET": "<secret>"
        }