mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Added logic to make SQL MIAA script to notebook with user-inputted values, and minor text changes. (#17452)
* Changed the placement of the getValue comment in IValueProvider interface. * Simplified some params values to feed into deployment notebook better. Added logic to add flags to the sql miaa create calls in notebook. Removed variablename from estimated cost. * Changed High Availability to Replicas Co-authored-by: Candice Ye <canye@microsoft.com>
This commit is contained in:
@@ -1,28 +1,10 @@
|
||||
{
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"name": "python3",
|
||||
"display_name": "Python 3",
|
||||
"language": "python"
|
||||
},
|
||||
"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",
|
||||
"metadata": {
|
||||
"azdata_cell_guid": "e4ed0892-7b5a-4d95-bd0d-a6c3eb0b2c99"
|
||||
},
|
||||
"source": [
|
||||
"\n",
|
||||
" \n",
|
||||
@@ -34,13 +16,13 @@
|
||||
"* Make sure you have the target Azure Arc Data Controller already created.\n",
|
||||
"\n",
|
||||
"<span style=\"color:red\"><font size=\"3\">Please press the \"Run All\" button to run the notebook</font></span>"
|
||||
],
|
||||
"metadata": {
|
||||
"azdata_cell_guid": "e4ed0892-7b5a-4d95-bd0d-a6c3eb0b2c99"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"azdata_cell_guid": "d1c8258e-9efd-4380-a48c-cd675423ed2f"
|
||||
},
|
||||
"source": [
|
||||
"### **Prerequisites** \n",
|
||||
"Ensure the following tools are installed and added to PATH before proceeding.\n",
|
||||
@@ -49,23 +31,25 @@
|
||||
"|---|---|---|\n",
|
||||
"|Azure CLI (az) | Command-line tool for installing and managing resources in an Azure Arc cluster |[Installation](https://docs.microsoft.com/cli/azure/install-azure-cli-windows?tabs=azure-cli) |\n",
|
||||
"|Azure CLI arcdata extension | Commands for using Azure Arc for Azure data services. | [Installation](https://docs.microsoft.com/azure/azure-arc/data/install-arcdata-extension)"
|
||||
],
|
||||
"metadata": {
|
||||
"azdata_cell_guid": "d1c8258e-9efd-4380-a48c-cd675423ed2f"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
"### **Setup and Check Prerequisites**"
|
||||
],
|
||||
"metadata": {
|
||||
"azdata_cell_guid": "68531b91-ddce-47d7-a1d8-2ddc3d17f3e7"
|
||||
}
|
||||
},
|
||||
"source": [
|
||||
"### **Setup and Check Prerequisites**"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"azdata_cell_guid": "749d8dba-3da8-46e9-ae48-2b38056ab7a2",
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import sys,os,json,subprocess\n",
|
||||
"def run_command():\n",
|
||||
@@ -80,38 +64,37 @@
|
||||
" return output.stdout.decode(\"utf-8\")\n",
|
||||
"cmd = 'az --version'\n",
|
||||
"out = run_command()\n"
|
||||
],
|
||||
"outputs": [],
|
||||
"metadata": {
|
||||
"azdata_cell_guid": "749d8dba-3da8-46e9-ae48-2b38056ab7a2",
|
||||
"tags": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"azdata_cell_guid": "68ec0760-27d1-4ded-9a9f-89077c40b8bb"
|
||||
},
|
||||
"source": [
|
||||
"### **Set variables**\n",
|
||||
"\n",
|
||||
"#### \n",
|
||||
"\n",
|
||||
"Generated by Azure Data Studio using the values collected in the 'Deploy Azure SQL managed instance - Azure Arc' wizard"
|
||||
],
|
||||
"metadata": {
|
||||
"azdata_cell_guid": "68ec0760-27d1-4ded-9a9f-89077c40b8bb"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
"### **Creating the SQL managed instance - Azure Arc instance**"
|
||||
],
|
||||
"metadata": {
|
||||
"azdata_cell_guid": "90b0e162-2987-463f-9ce6-12dda1267189"
|
||||
}
|
||||
},
|
||||
"source": [
|
||||
"### **Creating the SQL managed instance - Azure Arc instance**"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"azdata_cell_guid": "4fbaf071-55a1-40bc-be7e-7b9b5547b886"
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"print (f'Creating the SQL managed instance - Azure Arc instance')\n",
|
||||
"\n",
|
||||
@@ -124,24 +107,44 @@
|
||||
"storage_class_datalogs_option = f' --storage-class-datalogs \"{sql_storage_class_datalogs}\"'if sql_storage_class_datalogs else \"\"\n",
|
||||
"storage_class_logs_option = f' --storage-class-logs \"{sql_storage_class_logs}\"'if sql_storage_class_logs else \"\"\n",
|
||||
"storage_class_backup_option = f' --storage-class-backups \"{sql_storage_class_backups}\"'if sql_storage_class_backups else \"\"\n",
|
||||
"retention_days = f' --retention-days \"{sql_retention_days}\"' if sql_retention_days else \"\"\n",
|
||||
"retention_days = f' --retention-days \"{sql_retention_days}\"' if sql_retention_days else \"\"\n",
|
||||
"\n",
|
||||
"volume_size_data = f' --volume-size-data {sql_volume_size_data}Gi'\n",
|
||||
"volume_size_datalogs = f' --volume-size-datalogs {sql_volume_size_datalogs}Gi'\n",
|
||||
"volume_size_logs = f' --volume-size-logs {sql_volume_size_logs}Gi'\n",
|
||||
"volume_size_backups = f' --volume-size-backups {sql_volume_size_backups}Gi'\n",
|
||||
"\n",
|
||||
|
||||
"service_tier = f' --tier {sql_service_tier}'\n",
|
||||
"cores_limit = f' --cores-limit {sql_cores_limit}'\n",
|
||||
"dev_use = ' --dev' if sql_dev_use else ''\n",
|
||||
"license_type = ' --license-type BasePrice' if sql_license_type else ' --license-type LicenseIncluded'\n",
|
||||
"\n",
|
||||
"os.environ[\"AZDATA_USERNAME\"] = sql_username\n",
|
||||
"os.environ[\"AZDATA_PASSWORD\"] = os.environ[\"AZDATA_NB_VAR_SQL_PASSWORD\"]\n",
|
||||
"cmd = f'az sql mi-arc create --name {sql_instance_name} --k8s-namespace {arc_data_controller_namespace} --replicas {sql_replicas}{cores_request_option}{cores_limit_option}{memory_request_option}{memory_limit_option}{storage_class_data_option}{storage_class_datalogs_option}{storage_class_logs_option}{storage_class_backup_option}{volume_size_data}{volume_size_datalogs}{volume_size_logs}{volume_size_backups}{retention_days} --use-k8s'\n",
|
||||
|
||||
"cmd = f'az sql mi-arc create --name {sql_instance_name} --k8s-namespace {arc_data_controller_namespace} --replicas {sql_replicas}{cores_request_option}{cores_limit_option}{memory_request_option}{memory_limit_option}{storage_class_data_option}{storage_class_datalogs_option}{storage_class_logs_option}{storage_class_backup_option}{volume_size_data}{volume_size_datalogs}{volume_size_logs}{volume_size_backups}{retention_days}{service_tier}{dev_use}{license_type}{cores_limit} --use-k8s'\n",
|
||||
"out=run_command()"
|
||||
],
|
||||
"outputs": [],
|
||||
"metadata": {
|
||||
"azdata_cell_guid": "4fbaf071-55a1-40bc-be7e-7b9b5547b886"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.6.6"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
||||
|
||||
@@ -983,7 +983,7 @@
|
||||
"fields": [
|
||||
{
|
||||
"type": "options",
|
||||
"label": "%arc.sql.high.availability.label%",
|
||||
"label": "%arc.sql.replicas%",
|
||||
"description": "%arc.sql.high.availability.description%",
|
||||
"required": true,
|
||||
"variableName": "AZDATA_NB_VAR_SQL_REPLICAS",
|
||||
@@ -1253,7 +1253,6 @@
|
||||
{
|
||||
"label": "%arc.sql.cost.summary.estimated.cost.per.month%",
|
||||
"type": "readonly_text",
|
||||
"variableName": "AZDATA_NB_VAR_SQL_ESTIMATED_COST",
|
||||
"defaultValue": "0.00 USD",
|
||||
"valueProvider": {
|
||||
"providerId": "params-to-estimated-cost",
|
||||
|
||||
@@ -88,13 +88,13 @@
|
||||
"arc.sql.invalid.instance.name": "Instance name must consist of lower case alphanumeric characters or '-', start with a letter, end with an alphanumeric character, and be 13 characters or fewer in length.",
|
||||
"arc.storage-class.dc.label": "Storage Class",
|
||||
"arc.sql.storage-class.dc.description": "The storage class to be used for all data and logs persistent volumes for all data controller pods that require them.",
|
||||
"arc.sql.high.availability.label": "High Availability",
|
||||
"arc.sql.high.availability.description": "Enable additional replicas for high availabilty. The compute and storage configuration selected below will be applied to all replicas.",
|
||||
"arc.sql.service.tier.general.purpose": "General Purpose (Up to 24 vCores and 128 Gi of RAM, standard high availability)",
|
||||
"arc.sql.service.tier.business.critical": "[PREVIEW] Business Critical (Unlimited vCores and RAM, advanced high availability)",
|
||||
"arc.sql.one.replica": "1 replica",
|
||||
"arc.sql.two.replicas": "2 replicas",
|
||||
"arc.sql.three.replicas": "3 replicas",
|
||||
"arc.sql.replicas": "Replicas",
|
||||
"arc.sql.high.availability.description": "Enable additional replicas for high availabilty. The compute and storage configuration selected below will be applied to all replicas. Choose from: General Purpose (Up to 24 vCores and 128 Gi of RAM, standard high availability) or [PREVIEW] Business Critical (Unlimited vCores and RAM, advanced high availability).",
|
||||
"arc.sql.service.tier.general.purpose": "GeneralPurpose",
|
||||
"arc.sql.service.tier.business.critical": "BusinessCritical",
|
||||
"arc.sql.one.replica": "1",
|
||||
"arc.sql.two.replicas": "2",
|
||||
"arc.sql.three.replicas": "3",
|
||||
"arc.storage-class.data.label": "Storage Class (Data)",
|
||||
"arc.sql.storage-class.data.description": "The storage class to be used for data (.mdf). If no value is specified, the default storage class will be used.",
|
||||
"arc.sql.cost.summary.sql.miaa.cost.summary": "SQL Managed Instance - Azure Arc Cost Summary",
|
||||
|
||||
@@ -275,11 +275,11 @@ export function copyConnectionStringToClipboard(type: string): string { return l
|
||||
export function copyValueToClipboard(valueName: string): string { return localize({ key: 'arc.copyValueToClipboard', comment: ['{0} is the name of the type of value being copied (e.g. Coordinator endpoint)'] }, "Copy {0} to clipboard", valueName); }
|
||||
|
||||
// Pricing Constants
|
||||
export const replicaOne = localize('arc.replicaOne', "1 replica");
|
||||
export const replicaTwo = localize('arc.replicaTwo', "2 replicas");
|
||||
export const replicaThree = localize('arc.replicaThree', "3 replicas");
|
||||
export const generalPurposeLabel = localize('arc.generalPurposeLabel', "General Purpose (Up to 24 vCores and 128 Gi of RAM, standard high availability)");
|
||||
export const businessCriticalLabel = localize('arc.businessCriticalLabel', "[PREVIEW] Business Critical (Unlimited vCores and RAM, advanced high availability)");
|
||||
export const replicaOne = localize('arc.replicaOne', "1");
|
||||
export const replicaTwo = localize('arc.replicaTwo', "2");
|
||||
export const replicaThree = localize('arc.replicaThree', "3");
|
||||
export const generalPurposeLabel = localize('arc.generalPurposeLabel', "GeneralPurpose");
|
||||
export const businessCriticalLabel = localize('arc.businessCriticalLabel', "BusinessCritical");
|
||||
export const USD = localize('arc.USD', "USD");
|
||||
|
||||
// Errors
|
||||
|
||||
@@ -26,12 +26,12 @@ declare module 'resource-deployment' {
|
||||
|
||||
export type InputValueType = string | number | boolean | undefined;
|
||||
|
||||
/**
|
||||
* Gets a calculated value based on the given input values.
|
||||
* @param triggerValues A map of the trigger field names and their current values specified in the valueProvider field info
|
||||
*/
|
||||
export interface IValueProvider {
|
||||
readonly id: string,
|
||||
/**
|
||||
* Gets a calculated value based on the given input values.
|
||||
* @param triggerValues A map of the trigger field names and their current values specified in the valueProvider field info
|
||||
*/
|
||||
getValue(triggerValues: string | {[key: string]: InputValueType}): Promise<InputValueType>;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user