Added Azure provisioning#22105
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds an Azure SQL Database provisioning flow to the Deployment webview, including a new deployment type, wizard pages (info/form/provisioning), supporting reducers/state, and Azure ARM helper methods to create resource groups, servers, and databases.
Changes:
- Adds a new Azure SQL Database deployment type to the Deployment webview UI (selector card + wizard pages + advanced options/tags).
- Introduces Azure SQL-specific shared state/reducers and backend deployment helpers to load Azure “cascading” components and perform provisioning + connection.
- Extends Azure helper utilities to support resource groups, locations, SQL server creation, database creation, and maintenance configurations; adds dependencies needed for public IP + maintenance.
Reviewed changes
Copilot reviewed 26 out of 27 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| localization/xliff/vscode-mssql.xlf | Adds localization entries for the new Azure SQL Database provisioning UI (ignored for detailed review per guidelines). |
| extensions/mssql/src/webviews/pages/Deployment/deploymentStateProvider.tsx | Adds RPC actions for Azure SQL Database deployment flow and memoizes formAction. |
| extensions/mssql/src/webviews/pages/Deployment/deploymentStartPage.tsx | Routes into the Azure SQL Database wizard once its state is loaded/ready. |
| extensions/mssql/src/webviews/pages/Deployment/deploymentSelector.ts | Adds an Azure SQL Database-specific selector hook. |
| extensions/mssql/src/webviews/pages/Deployment/chooseDeploymentTypePage.tsx | Adds the Azure SQL Database deployment type card to the chooser UI. |
| extensions/mssql/src/webviews/pages/Deployment/AzureSqlDatabase/docsLinkCard.tsx | New reusable card component to show “what’s next” documentation links. |
| extensions/mssql/src/webviews/pages/Deployment/AzureSqlDatabase/createServerDrawer.tsx | New drawer UI to create an Azure SQL logical server (location + auth + credentials). |
| extensions/mssql/src/webviews/pages/Deployment/AzureSqlDatabase/createResourceGroupDrawer.tsx | New drawer UI to create a resource group with location selection. |
| extensions/mssql/src/webviews/pages/Deployment/AzureSqlDatabase/azureSqlDatabaseProvisioningPage.tsx | New provisioning status page (deployment + connection progress + docs links). |
| extensions/mssql/src/webviews/pages/Deployment/AzureSqlDatabase/azureSqlDatabaseInfoPage.tsx | New intro/info page describing Azure SQL DB and linking to docs. |
| extensions/mssql/src/webviews/pages/Deployment/AzureSqlDatabase/azureSqlDatabaseFormPage.tsx | New form page with cascading Azure selectors, auth fields, free-tier behavior, and advanced options drawer. |
| extensions/mssql/src/webviews/pages/Deployment/AzureSqlDatabase/azureSqlDatabaseDeploymentWizard.tsx | New wizard wiring pages together and triggering provisioning via reducers. |
| extensions/mssql/src/webviews/pages/Deployment/AzureSqlDatabase/advancedOptionsDrawer.tsx | New advanced options drawer (maintenance, firewall info, tags). |
| extensions/mssql/src/webviews/common/locConstants.ts | Adds webview localization bundle for Azure SQL Database provisioning strings. |
| extensions/mssql/src/webviews/common/icons/azureSqlDatabase.tsx | Adds an Azure SQL Database icon used in deployment chooser/wizard. |
| extensions/mssql/src/webviews/common/forms/form.component.tsx | Tweaks label decoration spacing (columnGap -> gap). |
| extensions/mssql/src/sharedInterfaces/telemetry.ts | Adds telemetry view/actions for Azure SQL Database deployment operations. |
| extensions/mssql/src/sharedInterfaces/form.ts | Expands FormEvent.value to allow numbers (needed for autoPauseDelay). |
| extensions/mssql/src/sharedInterfaces/deployment.ts | Extends deployment state/context/reducers to include Azure SQL Database types. |
| extensions/mssql/src/sharedInterfaces/azureSqlDatabase.ts | Adds new shared interfaces/state/reducers/constants for Azure SQL Database deployment. |
| extensions/mssql/src/deployment/deploymentWebviewController.ts | Integrates Azure SQL Database state init, reducer registration, cascading resets, and close telemetry. |
| extensions/mssql/src/deployment/azureSqlDatabaseHelpers.ts | New backend helper: loads Azure components, provisions DB, creates firewall rule, connects, and emits telemetry. |
| extensions/mssql/src/constants/locConstants.ts | Adds backend localization strings for Azure SQL Database helper flows. |
| extensions/mssql/src/connectionconfig/azureHelpers.ts | Adds ARM helpers for resource groups, locations, SQL servers, DB creation, and maintenance configs. |
| extensions/mssql/package.json | Adds dependencies for maintenance ARM SDK and public IP detection. |
| extensions/mssql/package-lock.json | Locks new dependencies. |
| extensions/mssql/l10n/bundle.l10n.json | Adds localized strings for the new feature (ignored for detailed review per guidelines). |
Files not reviewed (1)
- extensions/mssql/package-lock.json: Language not supported
Comments suppressed due to low confidence (3)
extensions/mssql/src/webviews/pages/Deployment/chooseDeploymentTypePage.tsx:136
- The keyboard handler is comparing
event.keyagainstKeyCode.Space, butKeyCode.Spacecorresponds to the KeyboardEventcodevalue ("Space"), whileevent.keyfor the spacebar is typically " ". This makes Space key activation unreliable for keyboard users. Useevent.codewithKeyCode.Enter/Space(and consider aligning the other cards to the same pattern).
onKeyDown={(event) => {
if (event.key === KeyCode.Enter || event.key === KeyCode.Space) {
event.preventDefault();
onDeploymentTypeChange(DeploymentType.LocalContainers);
}
}}
extensions/mssql/src/deployment/azureSqlDatabaseHelpers.ts:274
loadAzureComponentalways setsazureComponentStatuses[payload.componentName] = ApiStatus.Loadedafter the loader runs. Several loaders set the status toApiStatus.Erroron missing prerequisites, but this assignment overwrites the error state and can cause the UI to treat failed components as successfully loaded. Only setLoadedwhen the loader succeeded (or setLoadingbefore await and leaveErrorintact).
}
azureSqlState.azureComponentStatuses[payload.componentName] = ApiStatus.Loaded;
state.deploymentTypeState = azureSqlState;
return state;
extensions/mssql/src/deployment/azureSqlDatabaseHelpers.ts:359
createFirewallRuleWithVscodeAccount(...)is fired-and-forgotten without a.catch(...)/await. If it throws (e.g.,publicIpis empty or token construction fails), this can surface as an unhandled promise rejection in the extension host. Consider guarding whenpublicIpis unavailable and/or awaiting the call in a try/catch (or explicitly handling rejection with logging).
accountId: azureSqlState.formState.accountId,
tenantId: azureSqlState.formState.tenantId,
},
ip: azureSqlState.publicIp,
} as FirewallRuleSpec,
| const handleAddTag = () => { | ||
| setTagError(undefined); | ||
| onTagsChange([...tags, { id: tagIdCounter.current++, key: "", value: "" }]); | ||
| }; |
| const tagsRecord: Record<string, string> = {}; | ||
| for (const tag of tags) { | ||
| const trimmedKey = tag.key.trim(); | ||
| if (trimmedKey) { | ||
| tagsRecord[trimmedKey] = tag.value; |
| integratedAndSecureDescription: l10n.t( | ||
| "Built-in encryption, firewall rules, and Microsoft Entra ID integration to protect your data.", | ||
| ), | ||
| learnMore: l10n.t("Learn more"), |
| export async function initializeAzureSqlDatabaseState( | ||
| deploymentController: DeploymentWebviewController, | ||
| groupOptions: FormItemOptions[], | ||
| logger: Logger, | ||
| selectedGroupId: string | undefined, | ||
| ): Promise<asd.AzureSqlDatabaseState> { | ||
| cachedLogger = logger; | ||
| clearAllCaches(); | ||
| const startTime = Date.now(); | ||
| const state = new asd.AzureSqlDatabaseState(); | ||
|
|
||
| state.formState = { | ||
| accountId: "", | ||
| tenantId: "", | ||
| subscriptionId: "", | ||
| resourceGroup: "", | ||
| serverName: "", | ||
| databaseName: "", | ||
| authenticationType: AuthenticationType.AzureMFA, | ||
| userName: "", | ||
| password: "", | ||
| savePassword: false, | ||
| autoPauseDelay: 60, | ||
| profileName: "", | ||
| groupId: selectedGroupId || groupOptions[0]?.value || "", | ||
| collation: COLLATION_OPTIONS[0], | ||
| maintenanceConfig: "", | ||
| dataSource: "", | ||
| enableAlwaysEncrypted: false, | ||
| }; | ||
| try { | ||
| state.publicIp = await publicIpv4.v4(); | ||
| } catch { | ||
| state.publicIp = ""; | ||
| logger.warn("Could not detect public IP for firewall rule"); | ||
| } | ||
|
|
||
| deploymentController.state.deploymentTypeState = state; | ||
| state.formComponents = setAzureSqlDatabaseFormComponents([], [], groupOptions, [], []); | ||
| state.loadState = ApiStatus.Loaded; | ||
| sendActionEvent( | ||
| TelemetryViews.AzureSqlDatabase, | ||
| TelemetryActions.StartAzureSqlDatabaseDeployment, | ||
| {}, | ||
| { azureSqlDatabaseInitTimeInMs: Date.now() - startTime }, | ||
| ); | ||
|
|
||
| return state; | ||
| } |
PR Changes
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #22105 +/- ##
==========================================
- Coverage 74.85% 74.06% -0.80%
==========================================
Files 395 397 +2
Lines 120544 122325 +1781
Branches 7218 7220 +2
==========================================
+ Hits 90237 90594 +357
- Misses 30307 31731 +1424
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Description
Added azure provisioning feature
Todo:
Code Changes Checklist
npm run test)Reviewers: Please read our reviewer guidelines