mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
ASDE updates (#12134)
* add storage account cleanup and other misc stuff * force load * cell -> code cell
This commit is contained in:
@@ -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('<span style=\"color:red\"><font size=\"2\">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.</font></span>'))\r\n",
|
||||
" display(HTML('<span><font size=\"2\">'+delete_storage_account_command+'</font></span>'))"
|
||||
],
|
||||
"metadata": {
|
||||
"azdata_cell_guid": "13d698eb-4c1c-42e4-be28-efb9bf8b8c37",
|
||||
"tags": [
|
||||
"hide_input"
|
||||
]
|
||||
},
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user