|
156 | 156 | "### Adding the database to a storage role\n",
|
157 | 157 | "\n",
|
158 | 158 | "Next, we need to add the Azure SQL Database to the Storage Blob Data Owner role. This is done via Access Control (IAM) in the Azure Portal or via Azure CLI.\n",
|
159 | | - "To start, navigate to the container page and click **+ Add**. Then in the dropdown, click **Add role assignment**.\n", |
| 159 | + "To start, navigate to the Access Control page in the Azure Storage Account you are using\n", |
160 | 160 | "\n",
|
161 | | - "\n", |
| 161 | + "\n", |
| 162 | + "\n", |
| 163 | + " and click **+ Add**. Then in the dropdown, click **Add role assignment**.\n", |
| 164 | + "\n", |
| 165 | + "\n", |
162 | 166 | "\n",
|
163 | 167 | "On the following page, use the search box and enter **blob owner**. The roles list should then show the **Storage Blob Data Owner** role. Click the role and then click the **Next** button on the bottom of the page.\n",
|
164 | 168 | "\n",
|
|
246 | 250 | "select cast(@response as xml)\n",
|
247 | 251 | "go"
|
248 | 252 | ]
|
| 253 | + }, |
| 254 | + { |
| 255 | + "cell_type": "markdown", |
| 256 | + "metadata": {}, |
| 257 | + "source": [ |
| 258 | + "We can also read blob just as before as well. Use the following code to read the json file we created earlier but now using a managed identity. As before, you need to update the date (\"x-ms-date\" : \"2023年8月09日 19:54:40 GMT\") to a recent timestamp otherwise you will get an error on submission of the request." |
| 259 | + ] |
| 260 | + }, |
| 261 | + { |
| 262 | + "cell_type": "code", |
| 263 | + "execution_count": null, |
| 264 | + "metadata": {}, |
| 265 | + "outputs": [], |
| 266 | + "source": [ |
| 267 | + "declare @response nvarchar(max);\n", |
| 268 | + "declare @url nvarchar(max) = 'https://blobby.blob.core.windows.net/myblobs/test-me-from-azure-sql.json'\n", |
| 269 | + "exec sp_invoke_external_rest_endpoint\n", |
| 270 | + " @url = @url,\n", |
| 271 | + " @headers = '{\"Accept\":\"application/xml\",\"x-ms-version\" : \"2023年08月03日\",\"x-ms-date\" : \"2023年8月09日 20:04:55 GMT\",\"Content-Type\":\"application/xml\"}',\n", |
| 272 | + " @method = 'GET',\n", |
| 273 | + " @credential = [https://blobby.blob.core.windows.net],\n", |
| 274 | + " @response = @response output\n", |
| 275 | + "select cast(@response as xml)\n", |
| 276 | + "go\n" |
| 277 | + ] |
249 | 278 | }
|
250 | 279 | ],
|
251 | 280 | "metadata": {
|
|
0 commit comments