question

ShikhilKumarGuptaMSFT-2699 avatar image
0 Votes"
ShikhilKumarGuptaMSFT-2699 asked PRADEEPCHEEKATLA-MSFT commented

Need help on setting up Env variable in Azure Synapse Analytics Spark cluster

Hi Team, I have dev, ppe and prod Azure Synapse analytics workspace. I will be deploying my jar for some computation. Now I need to insert the ENV variable for ppe, prod and dev enviorment. So that my jar running in spark cluster can refer env variable value and based on it, it can load dev, ppe or prod config. But I am unable to find out how to pass custom env variable for Synapse workspace.

Can you guys help me to know that?

azure-synapse-analytics
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@PRADEEPCHEEKATLA-MSFT Could you please help me here?

0 Votes 0 ·
PRADEEPCHEEKATLA-MSFT avatar image PRADEEPCHEEKATLA-MSFT ShikhilKumarGuptaMSFT-2699 ·

Hello @ShikhilKumarGuptaMSFT-2699,

Thanks for the question and using MS Q&A platform.

We are reaching out to the internal team to confirm if the custom environment variables supported in Spark pool. I will be update you once I hear back from the team.

0 Votes 0 ·

Hello @ShikhilKumarGuptaMSFT-2699,

Following up to see if the below suggestion was helpful. And, if you have any further query do let us know.


  • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you.

0 Votes 0 ·

1 Answer

PRADEEPCHEEKATLA-MSFT avatar image
0 Votes"
PRADEEPCHEEKATLA-MSFT answered PRADEEPCHEEKATLA-MSFT commented

Hello @ShikhilKumarGuptaMSFT-2699,

Thanks for the question and using the MS Q&A platform.

You can read custom config values in a spark notebook as shown below.

Step1: Add your key-value pairs inside the config.txt file:

 spark.executorEnv.environmentName ppe

Step2: You can upload a config file to your spark pool.

162552-image.png

Step3: Which you are then able to access inside your notebooks:

 envName: str = spark.sparkContext.environment.get('environmentName', 'get')

Hope this will help. Please let us know if any further queries.


  • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how

  • Want a reminder to come back and check responses? Here is how to subscribe to a notification

  • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators


image.png (32.5 KiB)
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @ShikhilKumarGuptaMSFT-2699,

Just checking in to see if the above answer helped. If this answers your query, do click Accept Answer and Up-Vote for the same. And, if you have any further query do let us know.

0 Votes 0 ·
Rupeshgupta-1646 avatar image Rupeshgupta-1646 PRADEEPCHEEKATLA-MSFT ·

@PRADEEPCHEEKATLA-MSFT Is it possible to share the content of config.txt ? I would like to see how to define it inside the file.

0 Votes 0 ·

Hello @Rupeshgupta-1646,

It's simple key-value pairs inside the config.txt file as shown below:

200196-image.png


0 Votes 0 ·
image.png (5.1 KiB)