mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-14 03:58:33 -05:00
* unified admin user account (#7485) * azdata changes * spaces * error message * comments * support AD authentication for bdc deployment (#7518) * enable ad authentication * remove export for internal interface * add comments * more changes after testing * update notebooks * escape slash * more comments * Update deploy-bdc-aks.ipynb * Update deploy-bdc-existing-aks.ipynb * Update deploy-bdc-existing-kubeadm.ipynb * AD changes and review feedback (#7618) * enable ad authentication * remove export for internal interface * add comments * more changes after testing * update notebooks * escape slash * more comments * Update deploy-bdc-aks.ipynb * Update deploy-bdc-existing-aks.ipynb * Update deploy-bdc-existing-kubeadm.ipynb * address comments from scenario review (#7546) * support AD authentication for bdc deployment (#7518) * enable ad authentication * remove export for internal interface * add comments * more changes after testing * update notebooks * escape slash * more comments * Update deploy-bdc-aks.ipynb * Update deploy-bdc-existing-aks.ipynb * Update deploy-bdc-existing-kubeadm.ipynb * scenario review feedbacks * more fixes * adjust the display order of resource types * different way to implement left side buttons * revert unwanted changes * rename variable * more fixes for the scenario review feedback (#7589) * fix more issues * add help links * model view readonly text with links * fix size string * address comments * update notebooks * text update * address the feedback of 2nd round of deploy BDC wizard review (#7646) * 2nd review meeting comments * fix the unit test failure * recent changes in azdata * notebook background execution with azdata (#7741) * notebook background execution with azdata * prompt to open notebook in case of failure * fix path quote issue * better temp file handling * expose docker settings (#7751) * add docker settings * new icon for container image
408 lines
17 KiB
Plaintext
408 lines
17 KiB
Plaintext
{
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"name": "python3",
|
|
"display_name": "Python 3"
|
|
},
|
|
"language_info": {
|
|
"name": "python",
|
|
"version": "3.6.6",
|
|
"mimetype": "text/x-python",
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"pygments_lexer": "ipython3",
|
|
"nbconvert_exporter": "python",
|
|
"file_extension": ".py"
|
|
}
|
|
},
|
|
"nbformat_minor": 2,
|
|
"nbformat": 4,
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"source": [
|
|
"\n",
|
|
" \n",
|
|
"## Create Azure Kubernetes Service cluster and deploy SQL Server 2019 Big Data Cluster\n",
|
|
" \n",
|
|
"This notebook walks through the process of creating a new Azure Kubernetes Service cluster first, and then deploys a <a href=\"https://docs.microsoft.com/sql/big-data-cluster/big-data-cluster-overview?view=sqlallproducts-allversions\">SQL Server 2019 Big Data Cluster</a> on the newly created AKS cluster.\n",
|
|
" \n",
|
|
"* Follow the instructions in the **Prerequisites** cell to install the tools if not already installed.\n",
|
|
"* The **Required information** will check and prompt you for password if it is not set in the environment variable. The password will be used to access the cluster controller, SQL Server, and Knox.\n",
|
|
"\n",
|
|
"<span style=\"color:red\"><font size=\"3\">Please press the \"Run Cells\" button to run the notebook</font></span>"
|
|
],
|
|
"metadata": {
|
|
"azdata_cell_guid": "4f6bc3bc-3592-420a-b534-384011189005"
|
|
}
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"source": [
|
|
"### **Prerequisites**\n",
|
|
"Ensure the following tools are installed and added to PATH before proceeding.\n",
|
|
"\n",
|
|
"|Tools|Description|Installation|\n",
|
|
"|---|---|---|\n",
|
|
"|Azure CLI |Command-line tool for managing Azure services. Used to create AKS cluster | [Installation](https://docs.microsoft.com/cli/azure/install-azure-cli?view=azure-cli-latest) |\n",
|
|
"|kubectl | Command-line tool for monitoring the underlying Kuberentes cluster | [Installation](https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl-binary-using-native-package-management) |\n",
|
|
"|azdata | Command-line tool for installing and managing a Big Data Cluster |[Installation](https://docs.microsoft.com/en-us/sql/big-data-cluster/deploy-install-azdata?view=sqlallproducts-allversions) |"
|
|
],
|
|
"metadata": {
|
|
"azdata_cell_guid": "d949980e-ad3f-4d02-ae84-7e4fbb19a087"
|
|
}
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"source": [
|
|
"### **Check dependencies**"
|
|
],
|
|
"metadata": {
|
|
"azdata_cell_guid": "a56d3413-a730-4997-b5c2-c8abd972757e"
|
|
}
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"source": [
|
|
"import pandas,sys,os,json,html,getpass,time\n",
|
|
"pandas_version = pandas.__version__.split('.')\n",
|
|
"pandas_major = int(pandas_version[0])\n",
|
|
"pandas_minor = int(pandas_version[1])\n",
|
|
"pandas_patch = int(pandas_version[2])\n",
|
|
"if not (pandas_major > 0 or (pandas_major == 0 and pandas_minor > 24) or (pandas_major == 0 and pandas_minor == 24 and pandas_patch >= 2)):\n",
|
|
" sys.exit('Please upgrade the Notebook dependency before you can proceed, you can do it by running the \"Reinstall Notebook dependencies\" command in command palette (View menu -> Command Palette…).')\n",
|
|
"def run_command(command):\n",
|
|
" print(\"Executing: \" + command)\n",
|
|
" !{command}\n",
|
|
" if _exit_code != 0:\n",
|
|
" sys.exit(f'Command execution failed with exit code: {str(_exit_code)}.\\n\\t{command}\\n')\n",
|
|
" print(f'Successfully executed: {command}')\n",
|
|
"\n",
|
|
"run_command('kubectl version --client=true')\n",
|
|
"run_command('azdata --version')\n",
|
|
"run_command('az --version')"
|
|
],
|
|
"metadata": {
|
|
"azdata_cell_guid": "326645cf-022a-47f2-8aff-37de71da8955",
|
|
"tags": [
|
|
"hide_input"
|
|
]
|
|
},
|
|
"outputs": [],
|
|
"execution_count": 1
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"source": [
|
|
"### **Set variables**\n",
|
|
"Generated by Azure Data Studio using the values collected in the Deploy Big Data Cluster wizard"
|
|
],
|
|
"metadata": {
|
|
"azdata_cell_guid": "8716915b-1439-431b-ab0a-0221ef94cb7f"
|
|
}
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"source": [
|
|
"### **Required information**"
|
|
],
|
|
"metadata": {
|
|
"azdata_cell_guid": "720c200c-322a-49dd-9aa3-8bf7946aa251"
|
|
}
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"source": [
|
|
"invoked_by_wizard = \"AZDATA_NB_VAR_BDC_ADMIN_PASSWORD\" in os.environ\n",
|
|
"if invoked_by_wizard:\n",
|
|
" mssql_password = os.environ[\"AZDATA_NB_VAR_BDC_ADMIN_PASSWORD\"]\n",
|
|
"else:\n",
|
|
" mssql_password = getpass.getpass(prompt = 'SQL Server 2019 Big Data Cluster controller password')\n",
|
|
" if mssql_password == \"\":\n",
|
|
" sys.exit(f'Password is required.')\n",
|
|
" confirm_password = getpass.getpass(prompt = 'Confirm password')\n",
|
|
" if mssql_password != confirm_password:\n",
|
|
" sys.exit(f'Passwords do not match.')\n",
|
|
"print('You can also use the controller password to access Knox and SQL Server.')"
|
|
],
|
|
"metadata": {
|
|
"azdata_cell_guid": "17e5d087-7128-4d02-8c16-fe1ddee675e5",
|
|
"tags": [
|
|
"hide_input"
|
|
]
|
|
},
|
|
"outputs": [],
|
|
"execution_count": 2
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"source": [
|
|
"### **Login to Azure**\n",
|
|
"\n",
|
|
"This will open a web browser window to enable credentials to be entered. If this cells is hanging forever, it might be because your Web browser windows is waiting for you to enter your Azure credentials!\n",
|
|
""
|
|
],
|
|
"metadata": {
|
|
"azdata_cell_guid": "baddf2d9-93ee-4c42-aaf1-b42116bb1912"
|
|
}
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"source": [
|
|
"run_command(f'az login')"
|
|
],
|
|
"metadata": {
|
|
"azdata_cell_guid": "8f1404a6-216d-49fb-b6ad-81beeea50083",
|
|
"tags": [
|
|
"hide_input"
|
|
]
|
|
},
|
|
"outputs": [],
|
|
"execution_count": 5
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"source": [
|
|
"\n",
|
|
"### **Set active Azure subscription**"
|
|
],
|
|
"metadata": {
|
|
"azdata_cell_guid": "230dc0f1-bf6e-474a-bfaa-aae6f8aad12e"
|
|
}
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"source": [
|
|
"if azure_subscription_id != \"\":\n",
|
|
" run_command(f'az account set --subscription {azure_subscription_id}')\n",
|
|
"else:\n",
|
|
" print('Using the default Azure subscription', {azure_subscription_id})\n",
|
|
"run_command(f'az account show')"
|
|
],
|
|
"metadata": {
|
|
"azdata_cell_guid": "ab230931-2e99-483b-a229-3847684a8c1c",
|
|
"tags": [
|
|
"hide_input"
|
|
]
|
|
},
|
|
"outputs": [],
|
|
"execution_count": 6
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"source": [
|
|
"### **Create Azure resource group**"
|
|
],
|
|
"metadata": {
|
|
"azdata_cell_guid": "d51db914-f484-489f-990d-72edb3065068"
|
|
}
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"source": [
|
|
"run_command(f'az group create --name {azure_resource_group} --location {azure_region}')"
|
|
],
|
|
"metadata": {
|
|
"azdata_cell_guid": "7c53eb23-c327-41bf-8936-bd34a02ebdd5",
|
|
"tags": [
|
|
"hide_input"
|
|
]
|
|
},
|
|
"outputs": [],
|
|
"execution_count": 7
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"source": [
|
|
"### **Create AKS cluster**"
|
|
],
|
|
"metadata": {
|
|
"azdata_cell_guid": "818eb705-71e2-4013-8420-44886a5468b2"
|
|
}
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"source": [
|
|
"run_command(f'az aks create --name {aks_cluster_name} --resource-group {azure_resource_group} --generate-ssh-keys --node-vm-size {azure_vm_size} --node-count {azure_vm_count}')"
|
|
],
|
|
"metadata": {
|
|
"azdata_cell_guid": "3cea1da0-0c18-4030-a5aa-79bc98a5a14d",
|
|
"tags": [
|
|
"hide_input"
|
|
]
|
|
},
|
|
"outputs": [],
|
|
"execution_count": 8
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"source": [
|
|
"### **Set the new AKS cluster as current context**"
|
|
],
|
|
"metadata": {
|
|
"azdata_cell_guid": "5ade8453-5e71-478f-b6b6-83c55626243d"
|
|
}
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"source": [
|
|
"run_command(f'az aks get-credentials --resource-group {azure_resource_group} --name {aks_cluster_name} --admin --overwrite-existing')"
|
|
],
|
|
"metadata": {
|
|
"azdata_cell_guid": "9ccb9adf-1cf6-4dcb-8bd9-7ae9a85c2437",
|
|
"tags": [
|
|
"hide_input"
|
|
]
|
|
},
|
|
"outputs": [],
|
|
"execution_count": 9
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"source": [
|
|
"### **Create deployment configuration files**"
|
|
],
|
|
"metadata": {
|
|
"azdata_cell_guid": "57eb69fb-c68f-4ba8-818d-ffbaa0bc7aec"
|
|
}
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"source": [
|
|
"mssql_target_profile = 'ads-bdc-custom-profile'\n",
|
|
"if not os.path.exists(mssql_target_profile):\n",
|
|
" os.mkdir(mssql_target_profile)\n",
|
|
"bdcJsonObj = json.loads(bdc_json)\n",
|
|
"controlJsonObj = json.loads(control_json)\n",
|
|
"bdcJsonFile = open(f'{mssql_target_profile}/bdc.json', 'w')\n",
|
|
"bdcJsonFile.write(json.dumps(bdcJsonObj, indent = 4))\n",
|
|
"bdcJsonFile.close()\n",
|
|
"controlJsonFile = open(f'{mssql_target_profile}/control.json', 'w')\n",
|
|
"controlJsonFile.write(json.dumps(controlJsonObj, indent = 4))\n",
|
|
"controlJsonFile.close()\n",
|
|
"print(f'Created deployment configuration folder: {mssql_target_profile}')"
|
|
],
|
|
"metadata": {
|
|
"azdata_cell_guid": "3fd73c04-8a79-4d08-9049-1dad30265558",
|
|
"tags": [
|
|
"hide_input"
|
|
]
|
|
},
|
|
"outputs": [],
|
|
"execution_count": 10
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"source": [
|
|
"### **Create SQL Server 2019 Big Data Cluster**"
|
|
],
|
|
"metadata": {
|
|
"azdata_cell_guid": "6e82fad8-0fd0-4952-87ce-3fea1edd98cb"
|
|
}
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"source": [
|
|
"print (f'Creating SQL Server 2019 Big Data Cluster: {mssql_cluster_name} using configuration {mssql_target_profile}')\n",
|
|
"os.environ[\"ACCEPT_EULA\"] = 'yes'\n",
|
|
"os.environ[\"AZDATA_USERNAME\"] = mssql_username\n",
|
|
"os.environ[\"AZDATA_PASSWORD\"] = mssql_password\n",
|
|
"if os.name == 'nt':\n",
|
|
" print(f'If you don\\'t see output produced by azdata, you can run the following command in a terminal window to check the deployment status:\\n\\tkubectl get pods -n {mssql_cluster_name} ')\n",
|
|
"run_command(f'azdata bdc create -c {mssql_target_profile}')"
|
|
],
|
|
"metadata": {
|
|
"azdata_cell_guid": "c43ea026-ca5e-4e2a-8602-fcc786354168",
|
|
"tags": [
|
|
"hide_input"
|
|
]
|
|
},
|
|
"outputs": [],
|
|
"execution_count": 11
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"source": [
|
|
"### **Login to SQL Server 2019 Big Data Cluster**"
|
|
],
|
|
"metadata": {
|
|
"azdata_cell_guid": "9c5428f4-08b9-4799-a35d-867c91dc29fb"
|
|
}
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"source": [
|
|
"run_command(f'azdata login -n {mssql_cluster_name}')"
|
|
],
|
|
"metadata": {
|
|
"azdata_cell_guid": "5120c387-1088-435b-856e-e59f147c45a2",
|
|
"tags": [
|
|
"hide_input"
|
|
]
|
|
},
|
|
"outputs": [],
|
|
"execution_count": 12
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"source": [
|
|
"### **Show SQL Server 2019 Big Data Cluster endpoints**"
|
|
],
|
|
"metadata": {
|
|
"azdata_cell_guid": "97974eda-e108-4c21-a58e-c6bb58f14ef1"
|
|
}
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"source": [
|
|
"from IPython.display import *\n",
|
|
"pandas.set_option('display.max_colwidth', -1)\n",
|
|
"cmd = f'azdata bdc endpoint list'\n",
|
|
"cmdOutput = !{cmd}\n",
|
|
"endpoints = json.loads(''.join(cmdOutput))\n",
|
|
"endpointsDataFrame = pandas.DataFrame(endpoints)\n",
|
|
"endpointsDataFrame.columns = [' '.join(word[0].upper() + word[1:] for word in columnName.split()) for columnName in endpoints[0].keys()]\n",
|
|
"display(HTML(endpointsDataFrame.to_html(index=False, render_links=True)))"
|
|
],
|
|
"metadata": {
|
|
"azdata_cell_guid": "9a5d0aef-a8da-4845-b470-d714435f0304",
|
|
"tags": [
|
|
"hide_input"
|
|
]
|
|
},
|
|
"outputs": [],
|
|
"execution_count": 13
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"source": [
|
|
"### **Connect to SQL Server Master instance in Azure Data Studio**\n",
|
|
"Click the link below to connect to the SQL Server Master instance of the SQL Server 2019 Big Data Cluster."
|
|
],
|
|
"metadata": {
|
|
"azdata_cell_guid": "4a49b629-bd7a-43ba-bf18-6cdc0737b0f9"
|
|
}
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"source": [
|
|
"sqlEndpoints = [x for x in endpoints if x['name'] == 'sql-server-master']\n",
|
|
"if sqlEndpoints and len(sqlEndpoints) == 1:\n",
|
|
" connectionParameter = '{\"serverName\":\"' + sqlEndpoints[0]['endpoint'] + '\",\"providerName\":\"MSSQL\",\"authenticationType\":\"SqlLogin\",\"userName\":' + json.dumps(mssql_username) + ',\"password\":' + json.dumps(mssql_password) + '}'\n",
|
|
" display(HTML('<br/><a href=\"command:azdata.connect?' + html.escape(connectionParameter)+'\"><font size=\"3\">Click here to connect to SQL Server Master instance</font></a><br/>'))\n",
|
|
"else:\n",
|
|
" sys.exit('Could not find the SQL Server Master instance endpoint.')"
|
|
],
|
|
"metadata": {
|
|
"azdata_cell_guid": "1c9d1f2c-62ba-4070-920a-d30b67bdcc7c",
|
|
"tags": [
|
|
"hide_input"
|
|
]
|
|
},
|
|
"outputs": [],
|
|
"execution_count": 14
|
|
}
|
|
]
|
|
} |