From 1e49e47a37a5d6bfc2321b5f22b38f78227f04f7 Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Thu, 3 Sep 2020 22:12:10 -0700 Subject: [PATCH] ASDE updates (#12134) * add storage account cleanup and other misc stuff * force load * cell -> code cell --- extensions/asde-deployment/README.md | 17 ++++++++++++++++ .../edge/deploy-sql-edge-azure.ipynb | 19 ++++++++++++++++++ .../edge/deploy-sql-edge-multi-device.ipynb | 20 +++++++++++++++++++ .../edge/deploy-sql-edge-single-device.ipynb | 19 ++++++++++++++++++ extensions/asde-deployment/package.json | 1 - 5 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 extensions/asde-deployment/README.md diff --git a/extensions/asde-deployment/README.md b/extensions/asde-deployment/README.md new file mode 100644 index 0000000000..285a3dd5b5 --- /dev/null +++ b/extensions/asde-deployment/README.md @@ -0,0 +1,17 @@ +# Azure SQL Edge Deployment Extension for Azure Data Studio + +Welcome to the Azure SQL Edge Deployment Extension for Azure Data Studio! This extension provides a notebook-based experience to deploy Azure SQL Edge. + +## Code of Conduct + +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. + +## Privacy Statement + +The [Microsoft Enterprise and Developer Privacy Statement](https://privacy.microsoft.com/en-us/privacystatement) describes the privacy statement of this software. + +## License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Licensed under the [Source EULA](https://raw.githubusercontent.com/Microsoft/azuredatastudio/main/LICENSE.txt). diff --git a/extensions/asde-deployment/notebooks/edge/deploy-sql-edge-azure.ipynb b/extensions/asde-deployment/notebooks/edge/deploy-sql-edge-azure.ipynb index b9ac1a98b5..e1201f82c2 100644 --- a/extensions/asde-deployment/notebooks/edge/deploy-sql-edge-azure.ipynb +++ b/extensions/asde-deployment/notebooks/edge/deploy-sql-edge-azure.ipynb @@ -279,6 +279,7 @@ { "cell_type": "code", "source": [ + "storage_account_created = False\n", "if dacpac_path == \"\":\n", " print(f'Dacpac zip file not provided')\n", " blob_sas = ''\n", @@ -287,6 +288,7 @@ " storage_accounts = run_command(f'az storage account list --resource-group {azure_resource_group} --subscription {azure_subscription_id}', returnObject=True)\n", " storage_accounts = [storage_account for storage_account in storage_accounts if storage_account['name'] == azure_storage_account]\n", " if len(storage_accounts) == 0:\n", + " storage_account_created = True\n", " run_command(f'az storage account create -n {azure_storage_account} -g {azure_resource_group} -l {azure_location} --sku Standard_LRS --kind Storage')\n", " else:\n", " print(f'storage account \\\"{azure_storage_account}\\\" already exists.')\n", @@ -517,6 +519,23 @@ }, "outputs": [], "execution_count": null + }, + { + "cell_type": "code", + "source": [ + "if storage_account_created:\r\n", + " delete_storage_account_command = \"run_command(f'az storage account delete -n {azure_storage_account} -g {azure_resource_group} --yes')\"\r\n", + " display(HTML('NOTE: A storage account was created to host the dacpac file, you can delete it after the database is created and populated successfully. To delete the storage account, copy the following code to a new code cell and run the cell.'))\r\n", + " display(HTML(''+delete_storage_account_command+''))" + ], + "metadata": { + "azdata_cell_guid": "8b74ac43-a871-4d28-832d-e6da586f6d3a", + "tags": [ + "hide_input" + ] + }, + "outputs": [], + "execution_count": null } ] } \ No newline at end of file diff --git a/extensions/asde-deployment/notebooks/edge/deploy-sql-edge-multi-device.ipynb b/extensions/asde-deployment/notebooks/edge/deploy-sql-edge-multi-device.ipynb index 6fcd7076aa..e30e25301e 100644 --- a/extensions/asde-deployment/notebooks/edge/deploy-sql-edge-multi-device.ipynb +++ b/extensions/asde-deployment/notebooks/edge/deploy-sql-edge-multi-device.ipynb @@ -256,6 +256,7 @@ { "cell_type": "code", "source": [ + "storage_account_created = False\n", "if dacpac_path == \"\":\n", " print(f'Dacpac zip file not provided')\n", " blob_sas = ''\n", @@ -264,6 +265,7 @@ " storage_accounts = run_command(f'az storage account list --resource-group {azure_resource_group} --subscription {azure_subscription_id}', returnObject=True)\n", " storage_accounts = [storage_account for storage_account in storage_accounts if storage_account['name'] == azure_storage_account]\n", " if len(storage_accounts) == 0:\n", + " storage_account_created = True\n", " run_command(f'az storage account create -n {azure_storage_account} -g {azure_resource_group} --sku Standard_LRS --kind Storage')\n", " else:\n", " print(f'storage account \\\"{azure_storage_account}\\\" already exists.')\n", @@ -322,6 +324,24 @@ }, "outputs": [], "execution_count": null + }, + { + "cell_type": "code", + "source": [ + "from IPython.display import *\r\n", + "if storage_account_created:\r\n", + " delete_storage_account_command = \"run_command(f'az storage account delete -n {azure_storage_account} -g {azure_resource_group} --yes')\"\r\n", + " display(HTML('NOTE: A storage account was created to host the dacpac file, you can delete it after the database is created and populated successfully. To delete the storage account, copy the following code to a new code cell and run the cell.'))\r\n", + " display(HTML(''+delete_storage_account_command+''))" + ], + "metadata": { + "azdata_cell_guid": "13d698eb-4c1c-42e4-be28-efb9bf8b8c37", + "tags": [ + "hide_input" + ] + }, + "outputs": [], + "execution_count": null } ] } \ No newline at end of file diff --git a/extensions/asde-deployment/notebooks/edge/deploy-sql-edge-single-device.ipynb b/extensions/asde-deployment/notebooks/edge/deploy-sql-edge-single-device.ipynb index 077d291957..9509554ba8 100644 --- a/extensions/asde-deployment/notebooks/edge/deploy-sql-edge-single-device.ipynb +++ b/extensions/asde-deployment/notebooks/edge/deploy-sql-edge-single-device.ipynb @@ -264,6 +264,7 @@ { "cell_type": "code", "source": [ + "storage_account_created = False\n", "if dacpac_path == \"\":\n", " print(f'Dacpac zip file not provided')\n", " blob_sas = ''\n", @@ -272,6 +273,7 @@ " storage_accounts = run_command(f'az storage account list --resource-group {azure_resource_group} --subscription {azure_subscription_id}', returnObject=True)\n", " storage_accounts = [storage_account for storage_account in storage_accounts if storage_account['name'] == azure_storage_account]\n", " if len(storage_accounts) == 0:\n", + " storage_account_created = True\n", " run_command(f'az storage account create -n {azure_storage_account} -g {azure_resource_group} --sku Standard_LRS --kind Storage')\n", " else:\n", " print(f'storage account \\\"{azure_storage_account}\\\" already exists.')\n", @@ -360,6 +362,23 @@ }, "outputs": [], "execution_count": null + }, + { + "cell_type": "code", + "source": [ + "if storage_account_created:\r\n", + " delete_storage_account_command = \"run_command(f'az storage account delete -n {azure_storage_account} -g {azure_resource_group} --yes')\"\r\n", + " display(HTML('NOTE: A storage account was created to host the dacpac file, you can delete it after the database is created and populated successfully. To delete the storage account, copy the following code to a new code cell and run the cell.'))\r\n", + " display(HTML(''+delete_storage_account_command+''))" + ], + "metadata": { + "azdata_cell_guid": "e9d4188e-11c8-4aa5-8320-c3d0f6d023b2", + "tags": [ + "hide_input" + ] + }, + "outputs": [], + "execution_count": null } ] } \ No newline at end of file diff --git a/extensions/asde-deployment/package.json b/extensions/asde-deployment/package.json index 09612b5afa..e0a541d527 100644 --- a/extensions/asde-deployment/package.json +++ b/extensions/asde-deployment/package.json @@ -21,7 +21,6 @@ "resourceDeploymentTypes": [ { "name": "sql-edge", - "enabled": false, "displayName": "%resource-type-sql-edge-display-name%", "description": "%resource-type-sql-edge-description%", "platforms": "*",