Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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:
Solved! Go to Solution.
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.
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 @v-kpoloju-msft,
I've tested adding the Azure Account (which has been replaced by the Azure Resources extension) to my devcontainer.
This seem to do the trick for me.
So thanks for your suggestions!
And could you update the devcontainer file in your documentation? So it's using this extension by default? This could prevent this issue with other people
SynapseVSCode/samples/.devcontainer/devcontainer.json at main · microsoft/SynapseVSCode · GitHub
Kind regards,
Martijn
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.
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:
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>"
}
Thanks for the idea.
Is there any other way I can authenticate?
I'm not able to easily create a service principal.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Fabric update to learn about new features.