Skip to content

Commit

Permalink
Update Obtain credentials with TokenLibrary.ipynb
Browse files Browse the repository at this point in the history
  • Loading branch information
nirav2 authored Oct 12, 2020
1 parent dfef4b6 commit 0d500ce
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions Notebooks/PySpark/Obtain credentials with TokenLibrary.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@
"nbformat": 4,
"nbformat_minor": 2,
"cells": [
{
"cell_type": "code",
"execution_count": null,
"outputs": [],
"metadata": {},
"source": [
"For latest documentation please run TokenLibrary.help() from Notebook\n"
],
"attachments": {}
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -18,12 +28,8 @@
"# However, Linked services can be used for storing and retreiving credentials (e.g, account key)\n",
"# Example connection string (for storage): \"DefaultEndpointsProtocol=https;AccountName=<accountname>;AccountKey=<accountkey>\"\n",
"\n",
"from pyspark.sql import SparkSession\n",
"\n",
"sc = SparkSession.builder.getOrCreate()\n",
"token_library = sc._jvm.com.microsoft.azure.synapse.tokenlibrary.TokenLibrary\n",
"connection_string = token_library.getConnectionString(\"<linkedServiceName>\")\n",
"account_key = token_library.getConnectionStringAsMap(\"<linkedServiceName>\").get(\"AccountKey\")"
"connection_string = TokenLibrary.getConnectionString(\"<linkedServiceName>\")\n",
"account_key = TokenLibrary.getConnectionStringAsMap(\"<linkedServiceName>\").get(\"AccountKey\")"
],
"attachments": {}
}
Expand Down

0 comments on commit 0d500ce

Please sign in to comment.