add confirm password for notebooks (#6351)

* add confirm password for notebooks

* one password
This commit is contained in:
Alan Ren
2019-07-10 16:09:03 -07:00
committed by GitHub
parent 758804e9cd
commit ad805b993c
2 changed files with 15 additions and 15 deletions

View File

@@ -22,7 +22,7 @@
"cells": [
{
"cell_type": "markdown",
"source": "![11811317_10153406249401648_2787740058697948111_n](https://raw.githubusercontent.com/Microsoft/sqlworkshops/master/graphics/solutions-microsoft-logo-small.png)\n\n## Create Azure Kubernetes Service cluster and deploy SQL Server 2019 big data cluster\n\nThis notebook walks through the process of deploying a SQL Server 2019 big data cluster on Azure Kubernetes Service.\n\n* Please follow the instructions in the **Dependencies** cell to install the dependencies.\n* The **Required information** cell will prompt you for the required information to create a SQL Server 2019 big data cluster.\n* We have included some default settings in the **Azure settings** cell of this Notebook, Please review the default values and make changes accordingly.\n* If you are experiencing issue in the *Create AKS cluster* step you might need to re-run the cell, more information: https://docs.microsoft.com/en-us/azure/aks/kubernetes-service-principal#specify-a-service-principal-for-an-aks-cluster. \n\n",
"source": "![Microsoft](https://raw.githubusercontent.com/microsoft/azuredatastudio/master/src/sql/media/microsoft-small-logo.png)\n\n## Create Azure Kubernetes Service cluster and deploy SQL Server 2019 big data cluster\n\nThis notebook walks through the process of deploying a SQL Server 2019 big data cluster on Azure Kubernetes Service.\n\n* Please follow the instructions in the **Dependencies** cell to install the dependencies.\n* The **Required information** cell will prompt you for the required information to create a SQL Server 2019 big data cluster.\n* We have included some default settings in the **Azure settings** cell of this Notebook, Please review the default values and make changes accordingly.\n* If you are experiencing issue in the *Create AKS cluster* step you might need to re-run the cell, more information: https://docs.microsoft.com/en-us/azure/aks/kubernetes-service-principal#specify-a-service-principal-for-an-aks-cluster. \n\n",
"metadata": {}
},
{
@@ -49,7 +49,7 @@
},
{
"cell_type": "code",
"source": "import getpass\ndef get_user_input(input_name, is_password = False):\n if is_password:\n user_input = getpass.getpass(prompt = input_name)\n print(input_name + ': ***********')\n else:\n user_input = input(input_name)\n print(input_name + ': ' + user_input)\n if user_input == \"\":\n raise SystemExit(f'{input_name} is required')\n return user_input;\n\nmssql_cluster_name = get_user_input('Cluster name')\nbdc_controller_username = get_user_input('Controller username')\nbdc_controller_password = get_user_input('Controller password', True)\nbdc_mssql_sa_password = get_user_input('SQL Server password', True)\ndocker_username = get_user_input('Docker username')\ndocker_password = get_user_input('Docker password', True)",
"source": "import getpass\ndef get_user_input(input_name, is_password = False, confirm_password = False):\n if is_password:\n user_input = getpass.getpass(prompt = input_name)\n if confirm_password:\n user_input_confirm = getpass.getpass(prompt = 'Confirm '+ input_name)\n if user_input != user_input_confirm:\n raise SystemExit(f'{input_name} does not match the confirmation password')\n print(f'{input_name}: ******')\n else:\n user_input = input(input_name)\n print(input_name + ': ' + user_input)\n if user_input == \"\":\n raise SystemExit(f'{input_name} is required')\n return user_input;\n\nmssql_cluster_name = get_user_input('Cluster name')\nbdc_controller_username = get_user_input('Controller username')\nbdc_password = get_user_input('Controller password', True, True)\nprint('Knox and SQL Server will use the same password')\ndocker_username = get_user_input('Docker username')\ndocker_password = get_user_input('Docker password', True)",
"metadata": {},
"outputs": [],
"execution_count": 2
@@ -73,7 +73,7 @@
},
{
"cell_type": "code",
"source": "azure_resource_group = mssql_cluster_name\nbdc_knox_password = bdc_mssql_sa_password\naks_kubernetes_version = ''\naks_cluster_name = mssql_cluster_name\nmssqlctl_configuration_profile = 'aks-dev-test'\nmssqlctl_configuration_file = 'mssql-bdc-configuration'\n\n# Show parameter values\nprint('')\nprint(f'mssql_cluster_name = {mssql_cluster_name}')\nprint(f'azure_subscription_id = {azure_subscription_id}')\nprint(f'azure_vm_size = {azure_vm_size}')\nprint(f'azure_vm_count = {str(azure_vm_count)}')\nprint(f'azure_region = {azure_region}')\nprint(f'azure_resource_group = {azure_resource_group}')\nprint(f'aks_kubernetes_version = {aks_kubernetes_version}')\nprint(f'aks_cluster_name = {aks_cluster_name}')\nprint(f'docker_username = {docker_username}')\nprint(f'mssqlctl_configuration_profile = {mssqlctl_configuration_profile}')\nprint(f'mssqlctl_configuration_file = {mssqlctl_configuration_file}')\nprint(f'bdc_controller_username = {bdc_controller_username}')\nprint('')",
"source": "azure_resource_group = mssql_cluster_name\naks_kubernetes_version = ''\naks_cluster_name = mssql_cluster_name\nmssqlctl_configuration_profile = 'aks-dev-test'\nmssqlctl_configuration_file = 'mssql-bdc-configuration'\n\n# Show parameter values\nprint('')\nprint(f'mssql_cluster_name = {mssql_cluster_name}')\nprint(f'azure_subscription_id = {azure_subscription_id}')\nprint(f'azure_vm_size = {azure_vm_size}')\nprint(f'azure_vm_count = {str(azure_vm_count)}')\nprint(f'azure_region = {azure_region}')\nprint(f'azure_resource_group = {azure_resource_group}')\nprint(f'aks_kubernetes_version = {aks_kubernetes_version}')\nprint(f'aks_cluster_name = {aks_cluster_name}')\nprint(f'docker_username = {docker_username}')\nprint(f'mssqlctl_configuration_profile = {mssqlctl_configuration_profile}')\nprint(f'mssqlctl_configuration_file = {mssqlctl_configuration_file}')\nprint(f'bdc_controller_username = {bdc_controller_username}')\nprint('')",
"metadata": {},
"outputs": [],
"execution_count": 4
@@ -169,7 +169,7 @@
},
{
"cell_type": "code",
"source": "import os\nprint (f'Creating SQL Server 2019 big data cluster: {mssql_cluster_name} using configuration file {mssqlctl_configuration_file}')\nos.environ[\"CONTROLLER_USERNAME\"] = bdc_controller_username\nos.environ[\"CONTROLLER_PASSWORD\"] = bdc_controller_password\nos.environ[\"MSSQL_SA_PASSWORD\"] = bdc_mssql_sa_password\nos.environ[\"KNOX_PASSWORD\"] = bdc_knox_password\nos.environ[\"DOCKER_USERNAME\"] = docker_username\nos.environ[\"DOCKER_PASSWORD\"] = docker_password\n\ncmd = f'mssqlctl bdc create -c {mssqlctl_configuration_file} --accept-eula yes'\nrun_command()",
"source": "import os\nprint (f'Creating SQL Server 2019 big data cluster: {mssql_cluster_name} using configuration file {mssqlctl_configuration_file}')\nos.environ[\"CONTROLLER_USERNAME\"] = bdc_controller_username\nos.environ[\"CONTROLLER_PASSWORD\"] = bdc_password\nos.environ[\"MSSQL_SA_PASSWORD\"] = bdc_password\nos.environ[\"KNOX_PASSWORD\"] = bdc_password\nos.environ[\"DOCKER_USERNAME\"] = docker_username\nos.environ[\"DOCKER_PASSWORD\"] = docker_password\n\ncmd = f'mssqlctl bdc create -c {mssqlctl_configuration_file} --accept-eula yes'\nrun_command()",
"metadata": {},
"outputs": [],
"execution_count": 12
@@ -205,7 +205,7 @@
},
{
"cell_type": "code",
"source": "filteredEndpoints = [x for x in endpointsInJson if x['name'] == 'sql-server-master']\r\nif filteredEndpoints and len(filteredEndpoints) == 1:\r\n display(HTML(\"<h3><a href=\\\"command:azdata.connect?{&quot;serverName&quot;:&quot;\"+filteredEndpoints[0]['endpoint']+\"&quot;,&quot;providerName&quot;:&quot;MSSQL&quot;, &quot;authenticationType&quot;:&quot;SqlLogin&quot;,&quot;userName&quot;:&quot;sa&quot;,&quot;password&quot;:&quot;\"+bdc_mssql_sa_password+\"&quot;}\\\">Click here to connect to SQL Server</a></h3>\"))",
"source": "filteredEndpoints = [x for x in endpointsInJson if x['name'] == 'sql-server-master']\r\nif filteredEndpoints and len(filteredEndpoints) == 1:\r\n display(HTML(\"<h3><a href=\\\"command:azdata.connect?{&quot;serverName&quot;:&quot;\"+filteredEndpoints[0]['endpoint']+\"&quot;,&quot;providerName&quot;:&quot;MSSQL&quot;, &quot;authenticationType&quot;:&quot;SqlLogin&quot;,&quot;userName&quot;:&quot;sa&quot;,&quot;password&quot;:&quot;\"+bdc_password+\"&quot;}\\\">Click here to connect to SQL Server</a></h3>\"))",
"metadata": {},
"outputs": [],
"execution_count": 15