|
40 | 40 | "source": [
|
41 | 41 | "## Get the Dataset id\n",
|
42 | 42 | "\n",
|
43 | | - "To discover the Dataset Id that is needed to execute a DAX query using the *executeQuery* endpoint, you can go to your Power BI portal, and click on the Dataset link:\n", |
| 43 | + "To discover the Dataset Id that is needed to execute a DAX query using the _executeQuery_ endpoint, you can go to your Power BI portal, and click on the Dataset link:\n", |
44 | 44 | "\n",
|
45 | 45 | "The Dataset page will open up and the URL will be something like:\n",
|
46 | 46 | "\n",
|
47 | 47 | "```\n",
|
48 | | - "https://xyz.powerbi.com/groups/me/datasets/<DATASET_ID>/details\n", |
| 48 | + "https://xyz.powerbi.com/groups/me/datasets/DATASET_ID/details\n", |
| 49 | + "\n", |
49 | 50 | "```"
|
50 | 51 | ],
|
51 | 52 | "metadata": {
|
|
70 | 71 | "eyJ0eXAiOiJK.....5aOYpZSFrSiKYYD6Q\n",
|
71 | 72 | "```\n",
|
72 | 73 | "\n",
|
73 | | - "copy the whole string and use in the the following code replacing the \\<TOKEN\\> string after the `Bearer` text. Make sure also to replace the _<DATASET_ID>_ placeholder with the Dataset id you got in the previous step. Execute the T-SQL code. It will safely store the authentication token in a Database Scoped Credential so that it will be possible to use the token later with `sp_invoke_external_rest_endpoint`" |
| 74 | + "copy the whole string and use in the the following code replacing the `TOKEN` string after the `Bearer` text. Make sure also to replace the `DATASET_ID` placeholder with the Dataset id you got in the previous step. Execute the T-SQL code. It will safely store the authentication token in a Database Scoped Credential so that it will be possible to use the token later with `sp_invoke_external_rest_endpoint`" |
74 | 75 | ],
|
75 | 76 | "metadata": {
|
76 | 77 | "azdata_cell_guid": "6cf54ac8-0e87-4698-84a6-ae9b81934b5a"
|
|
86 | 87 | "end\n",
|
87 | 88 | "\n",
|
88 | 89 | "-- create database scoped credential\n",
|
89 | | - "if exists(select * from sys.database_scoped_credentials where [name] = 'https://api.powerbi.com/v1.0/myorg/datasets/<DATASET_ID>/executeQueries') begin\n", |
90 | | - " drop database scoped credential [https://api.powerbi.com/v1.0/myorg/datasets/<DATASET_ID>/executeQueries];\n", |
| 90 | + "if exists(select * from sys.database_scoped_credentials where [name] = 'https://api.powerbi.com/v1.0/myorg/datasets/DATASET_ID/executeQueries') begin\n", |
| 91 | + " drop database scoped credential [https://api.powerbi.com/v1.0/myorg/datasets/DATASET_ID/executeQueries];\n", |
91 | 92 | "end\n",
|
92 | | - "create database scoped credential [https://api.powerbi.com/v1.0/myorg/datasets/<DATASET_ID>/executeQueries]\n", |
93 | | - "with identity = 'HTTPEndpointHeaders', secret = '{\"Authorization\": \"Bearer <TOKEN>\"}';\n", |
| 93 | + "create database scoped credential [https://api.powerbi.com/v1.0/myorg/datasets/DATASET_ID/executeQueries]\n", |
| 94 | + "with identity = 'HTTPEndpointHeaders', secret = '{\"Authorization\": \"Bearer TOKEN\"}';\n", |
94 | 95 | "go"
|
95 | 96 | ],
|
96 | 97 | "metadata": {
|
|
118 | 119 | "cell_type": "code",
|
119 | 120 | "source": [
|
120 | 121 | "\n",
|
121 | | - "declare @url nvarchar(4000) = N'https://api.powerbi.com/v1.0/myorg/datasets/<DATASET_ID>/executeQueries';\n", |
| 122 | + "declare @url nvarchar(4000) = N'https://api.powerbi.com/v1.0/myorg/datasets/DATASET_ID/executeQueries';\n", |
122 | 123 | "declare @payload nvarchar(max) = N'{\n",
|
123 | 124 | " \"queries\": [\n",
|
124 | 125 | " {\n",
|
|
148 | 149 | "\t@method = 'POST',\n",
|
149 | 150 | "\t@url = @url,\n",
|
150 | 151 | "\t@payload = @payload,\n",
|
151 | | - "\t@credential = [https://api.powerbi.com/v1.0/myorg/datasets/<DATASET_ID>/executeQueries],\n", |
| 152 | + "\t@credential = [https://api.powerbi.com/v1.0/myorg/datasets/DATASET_ID/executeQueries],\n", |
152 | 153 | "\t@response = @response output;\n",
|
153 | 154 | "\n",
|
154 | 155 | "select * from openjson(@response, '$.result.results[0].tables[0].rows') with\n",
|
|
0 commit comments