Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ module containerAppEnv './modules/containerappenv.bicep' = if(deployContainerApp
module databases './modules/database.bicep' = if(deploySqlServer && testDbCountPerServer > 0 && userIdGuid != '' && userLoginName != ''){
name: 'databases'
scope: rg
dependsOn: [
identityResource
]
params: {
currentIpAddress: currentIpAddress
location: location
Expand Down
805 changes: 615 additions & 190 deletions infra/main.json

Large diffs are not rendered by default.

25 changes: 5 additions & 20 deletions infra/modules/database.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,14 @@ param vnetId string = ''
@description('Private endpoint subnet ID (required when usePrivateEndpoint is true)')
param privateEndpointSubnetId string = ''

var resourceGroupNameVar = '${namePrefix}-rg'
var sqlserverNameVar = '${namePrefix}sql'
var sqlpoolNameVar = '${namePrefix}pool'
var identityNameVar = '${namePrefix}identity'
var vnetNameVar = '${namePrefix}vnet'
var subnetNamesArray = split(subnetNames,',')


module networkResource 'network.bicep' = {
name: 'networkResource'
scope: resourceGroup(resourceGroupNameVar)
params: {
namePrefix: namePrefix
location: location
}
}

module identityResource 'identity.bicep' = {
name: 'identityResource'
scope: resourceGroup(resourceGroupNameVar)
params: {
identityName: identityNameVar
location: location
}
resource existingVnet 'Microsoft.Network/virtualNetworks@2023-05-01' existing = {
name: vnetNameVar
}


Expand Down Expand Up @@ -92,7 +77,7 @@ resource sqlserverA_VnetRule 'Microsoft.Sql/servers/virtualNetworkRules@2021-11-
name: '${sqlserverNameVar}A_${subnet}'
properties: {
ignoreMissingVnetServiceEndpoint: false
virtualNetworkSubnetId: resourceId('Microsoft.Network/virtualNetworks/subnets',networkResource.outputs.vnetName, subnet)
virtualNetworkSubnetId: resourceId('Microsoft.Network/virtualNetworks/subnets', existingVnet.name, subnet)

}
}]
Expand Down Expand Up @@ -171,7 +156,7 @@ resource sqlserverB_VnetRule 'Microsoft.Sql/servers/virtualNetworkRules@2021-11-
name: '${sqlserverNameVar}B_${subnet}'
properties: {
ignoreMissingVnetServiceEndpoint: false
virtualNetworkSubnetId: resourceId('Microsoft.Network/virtualNetworks/subnets',networkResource.outputs.vnetName, subnet)
virtualNetworkSubnetId: resourceId('Microsoft.Network/virtualNetworks/subnets', existingVnet.name, subnet)

}
}]
Expand Down
18 changes: 18 additions & 0 deletions scripts/tests/run_all_external_tests_in_aci.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,24 @@ param (
[Parameter()]
[string] $prefix
)

# Resolve prefix: parameter > azd env AZURE_NAME_PREFIX
if ([string]::IsNullOrWhiteSpace($prefix)) {
$prefix = azd env get-value AZURE_NAME_PREFIX 2>$null
if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($prefix)) {
$prefix = $null
} else {
Write-Host "Using prefix '$prefix' from azd environment variable AZURE_NAME_PREFIX" -ForegroundColor DarkGreen
}
}

if ([string]::IsNullOrWhiteSpace($prefix)) {
Write-Host "ERROR: The -prefix parameter is required." -ForegroundColor Red
Write-Host " Provide it as a parameter: .\run_all_external_tests_in_aci.ps1 -prefix <your-prefix>" -ForegroundColor Yellow
Write-Host " Or set it in your azd environment: azd env set AZURE_NAME_PREFIX <your-prefix>" -ForegroundColor Yellow
exit 1
}

$exitCode = 0
$timestamp = (Get-Date -Format 'yyyy-MM-dd-HHmmss')
Clear-Host
Expand Down
19 changes: 18 additions & 1 deletion scripts/tests/run_dependent_tests_in_aci.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
param
(
[Parameter(Mandatory=$true)]
[Parameter()]
[string] $prefix,

[string] $resourceGroupName,
Expand Down Expand Up @@ -61,6 +61,23 @@

$ErrorActionPreference = "Stop"

# Resolve prefix: parameter > azd env AZURE_NAME_PREFIX
if ([string]::IsNullOrWhiteSpace($prefix)) {
$prefix = azd env get-value AZURE_NAME_PREFIX 2>$null
if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($prefix)) {
$prefix = $null
} else {
Write-Host "Using prefix '$prefix' from azd environment variable AZURE_NAME_PREFIX" -ForegroundColor DarkGreen
}
}

if ([string]::IsNullOrWhiteSpace($prefix)) {
Write-Host "ERROR: The -prefix parameter is required." -ForegroundColor Red
Write-Host " Provide it as a parameter: .\run_dependent_tests_in_aci.ps1 -prefix <your-prefix>" -ForegroundColor Yellow
Write-Host " Or set it in your azd environment: azd env set AZURE_NAME_PREFIX <your-prefix>" -ForegroundColor Yellow
exit 1
}

Clear-Host

# Dot-source shared ACI test helpers
Expand Down
18 changes: 18 additions & 0 deletions src/SqlBuildManager.Console/Batch/BatchManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@
data.DeploymentConfiguration = new BatchDeploymentConfiguration() { VmConfiguration = virtualMachineConfiguration };
data.ScaleSettings = new BatchAccountPoolScaleSettings() { FixedScale = new BatchAccountFixedScaleSettings() { TargetDedicatedNodes = nodeCount } };
data.VmSize = vmSize;
data.TargetNodeCommunicationMode = azB.Models.NodeCommunicationMode.Simplified;

Check warning on line 657 in src/SqlBuildManager.Console/Batch/BatchManager.cs

View workflow job for this annotation

GitHub Actions / build

'NodeCommunicationMode' is obsolete: 'This type is obsolete and will be removed in a future release.'

Check warning on line 657 in src/SqlBuildManager.Console/Batch/BatchManager.cs

View workflow job for this annotation

GitHub Actions / build

'BatchAccountPoolData.TargetNodeCommunicationMode' is obsolete: 'This property is obsolete and will be removed in a future release. NodeCommunicationMode has been removed from the Batch service.'

Check warning on line 657 in src/SqlBuildManager.Console/Batch/BatchManager.cs

View workflow job for this annotation

GitHub Actions / build

'NodeCommunicationMode' is obsolete: 'This type is obsolete and will be removed in a future release.'

Check warning on line 657 in src/SqlBuildManager.Console/Batch/BatchManager.cs

View workflow job for this annotation

GitHub Actions / build

'BatchAccountPoolData.TargetNodeCommunicationMode' is obsolete: 'This property is obsolete and will be removed in a future release. NodeCommunicationMode has been removed from the Batch service.'

Check warning on line 657 in src/SqlBuildManager.Console/Batch/BatchManager.cs

View workflow job for this annotation

GitHub Actions / build

'NodeCommunicationMode' is obsolete: 'This type is obsolete and will be removed in a future release.'

Check warning on line 657 in src/SqlBuildManager.Console/Batch/BatchManager.cs

View workflow job for this annotation

GitHub Actions / build

'BatchAccountPoolData.TargetNodeCommunicationMode' is obsolete: 'This property is obsolete and will be removed in a future release. NodeCommunicationMode has been removed from the Batch service.'

Check warning on line 657 in src/SqlBuildManager.Console/Batch/BatchManager.cs

View workflow job for this annotation

GitHub Actions / build

'NodeCommunicationMode' is obsolete: 'This type is obsolete and will be removed in a future release.'

Check warning on line 657 in src/SqlBuildManager.Console/Batch/BatchManager.cs

View workflow job for this annotation

GitHub Actions / build

'BatchAccountPoolData.TargetNodeCommunicationMode' is obsolete: 'This property is obsolete and will be removed in a future release. NodeCommunicationMode has been removed from the Batch service.'

Check warning on line 657 in src/SqlBuildManager.Console/Batch/BatchManager.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

'NodeCommunicationMode' is obsolete: 'This type is obsolete and will be removed in a future release.'

Check warning on line 657 in src/SqlBuildManager.Console/Batch/BatchManager.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

'BatchAccountPoolData.TargetNodeCommunicationMode' is obsolete: 'This property is obsolete and will be removed in a future release. NodeCommunicationMode has been removed from the Batch service.'

Check warning on line 657 in src/SqlBuildManager.Console/Batch/BatchManager.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

'NodeCommunicationMode' is obsolete: 'This type is obsolete and will be removed in a future release.'

Check warning on line 657 in src/SqlBuildManager.Console/Batch/BatchManager.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

'BatchAccountPoolData.TargetNodeCommunicationMode' is obsolete: 'This property is obsolete and will be removed in a future release. NodeCommunicationMode has been removed from the Batch service.'

if (!string.IsNullOrWhiteSpace(cmdLine.NetworkArgs.SubnetName) && !string.IsNullOrWhiteSpace(cmdLine.NetworkArgs.VnetName))
{
Expand Down Expand Up @@ -707,6 +707,24 @@
}
}

// Check if network configuration matches (subnet is immutable — requires pool recreation)
var existingSubnetId = poolresult.Value.Data.NetworkConfiguration?.SubnetId?.ToString();
var requestedSubnetId = data.NetworkConfiguration?.SubnetId?.ToString();
bool networkMismatch = !string.Equals(existingSubnetId ?? "", requestedSubnetId ?? "", StringComparison.OrdinalIgnoreCase);

if (networkMismatch)
{
log.LogWarning($"The pool {poolId} network configuration does not match. Existing subnet: '{existingSubnetId ?? "none"}', Requested subnet: '{requestedSubnetId ?? "none"}'");
log.LogWarning($"Deleting pool {poolId} to recreate with correct network configuration (subnet is immutable)...");
await poolresult.Value.DeleteAsync(Azure.WaitUntil.Completed);
log.LogInformation($"Pool {poolId} deleted. Recreating with correct network configuration...");

ArmOperation<BatchAccountPoolResource> lro = await collection.CreateOrUpdateAsync(Azure.WaitUntil.Completed, poolId, data);
BatchAccountPoolResource result = lro.Value;
log.LogInformation($"Successfully recreated {os} pool {poolId} with {nodeCount} nodes");
return true;
}

// Check if User-Assigned Managed Identity needs to be assigned
var requestedIdentityResourceId = new ResourceIdentifier(cmdLine.IdentityArgs.ResourceId);
bool identityAssigned = poolresult.Value.Data.Identity?.UserAssignedIdentities?.ContainsKey(requestedIdentityResourceId) == true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@ private static Command AciSaveSettingsCommand
cmd.AddRange(DatabaseAuthArgs);
cmd.AddRange(IdentityArgumentsForContainerApp);
cmd.AddRange(ContainerRegistryAndImageOptions);
cmd.SetGroupedHelp(
new OptionGroup("Settings File", new List<Option> { settingsfileNewOption }),
new OptionGroup("ACI", new List<Option> { aciIResourceGroupNameOption, aciInstanceNameOption, subscriptionIdOption }),
new OptionGroup("Execution", new List<Option> { sectionPlaceholderOption, defaultscripttimeoutOption, timeoutretrycountOption, silentOption, cleartextOption }),
new OptionGroup("Connections & Secrets", new List<Option> { keyVaultNameOption, storageaccountnameOption, storageaccountkeyOption, eventhubconnectionOption, serviceBusconnectionOption }),
new OptionGroup("Event Hub", EventHubResourceOptions),
new OptionGroup("VNET", VnetOptions),
new OptionGroup("Authentication", DatabaseAuthArgs),
new OptionGroup("Identity", IdentityArgumentsForContainerApp),
new OptionGroup("Container Registry", ContainerRegistryAndImageOptions)
);
cmd.SetAction((parseResult) => {
var cmdLine = CommandLineArgsBinder.Bind(parseResult);
var clearText = parseResult.GetValue(cleartextOption);
Expand Down Expand Up @@ -96,6 +107,17 @@ private static Command AciRun
cmd.Add(identityResourceGroupOption);
cmd.Add(subscriptionIdOption);
cmd.AddRange(ConcurrencyRequiredOptions);
cmd.SetGroupedHelp(
new OptionGroup("Build Options", new List<Option> { jobnameRequiredOption, packagenameAsFileToUploadOption, overrideRequiredOption, platinumdacpacFileInfoOption, allowForObjectDeletionOption, aciMonitorOption, forceOption }),
new OptionGroup("ACI", new List<Option> { aciIResourceGroupNameNotReqOption, aciInstanceNameNotReqOption, aciContainerCountOption }),
new OptionGroup("Event Hub", EventHubResourceOptions),
new OptionGroup("VNET", VnetOptions),
new OptionGroup("Container Registry", ContainerRegistryAndImageOptions),
new OptionGroup("Connections & Secrets", new List<Option> { keyVaultNameOption, storageaccountnameOption, storageaccountkeyOption }),
new OptionGroup("Authentication", DatabaseAuthArgs),
new OptionGroup("Identity", new List<Option> { clientIdOption, identityNameOption, identityResourceGroupOption, subscriptionIdOption }),
new OptionGroup("Concurrency", ConcurrencyRequiredOptions)
);
cmd.SetAction(async (parseResult, ct) => {
var cmdLine = CommandLineArgsBinder.Bind(parseResult);
var packagename = parseResult.GetValue(packagenameAsFileToUploadOption);
Expand Down Expand Up @@ -148,7 +170,19 @@ private static Command AciQuery
cmd.Add(subscriptionIdOption);
cmd.AddRange(ConcurrencyRequiredOptions);
cmd.Add(streamEventsOption);

cmd.SetGroupedHelp(
new OptionGroup("Query", new List<Option> { overrideRequiredOption, queryFileOption, outputFileOption }),
new OptionGroup("ACI", new List<Option> { aciIResourceGroupNameNotReqOption, aciInstanceNameNotReqOption, aciContainerCountOption }),
new OptionGroup("Execution", new List<Option> { jobnameOption, aciMonitorOption, forceOption }),
new OptionGroup("Settings File", SettingsFileExistingOptions),
new OptionGroup("Event Hub", EventHubResourceOptions),
new OptionGroup("VNET", VnetOptions),
new OptionGroup("Container Registry", ContainerRegistryAndImageOptions),
new OptionGroup("Connections & Secrets", new List<Option> { keyVaultNameOption, storageaccountnameOption, storageaccountkeyOption }),
new OptionGroup("Authentication", new List<Option> { authtypeOption, platformOption }),
new OptionGroup("Identity", new List<Option> { clientIdOption, identityNameOption, identityResourceGroupOption, subscriptionIdOption }),
new OptionGroup("Concurrency", ConcurrencyRequiredOptions)
);

cmd.SetAction(async (parseResult, ct) => {
var cmdLine = CommandLineArgsBinder.Bind(parseResult);
Expand Down Expand Up @@ -257,6 +291,18 @@ private static Command AciDeployCommand
cmd.Add(clientIdOption);
cmd.Add(subscriptionIdOption);
cmd.AddRange(ConcurrencyRequiredOptions);
cmd.SetGroupedHelp(
new OptionGroup("Build Options", new List<Option> { jobnameRequiredOption, packagenameAsFileToUploadOption, overrideOption, platinumdacpacFileInfoOption, allowForObjectDeletionOption, aciMonitorOption }),
new OptionGroup("ACI", new List<Option> { aciIResourceGroupNameNotReqOption, aciInstanceNameNotReqOption, aciContainerCountOption }),
new OptionGroup("Settings File", new List<Option> { settingsfileExistingOption }),
new OptionGroup("Event Hub", EventHubResourceOptions),
new OptionGroup("VNET", VnetOptions),
new OptionGroup("Container Registry", ContainerRegistryAndImageOptions),
new OptionGroup("Connections & Secrets", new List<Option> { keyVaultNameOption, storageaccountnameOption, storageaccountkeyOption }),
new OptionGroup("Authentication", new List<Option> { authtypeOption, platformOption }),
new OptionGroup("Identity", new List<Option> { identityNameOption, identityResourceGroupOption, clientIdOption, subscriptionIdOption }),
new OptionGroup("Concurrency", ConcurrencyRequiredOptions)
);

cmd.SetAction(async (parseResult, ct) => {
var cmdLine = CommandLineArgsBinder.Bind(parseResult);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@ private static Command BatchRunCommand
cmd.AddRange(IdentityArgumentsForBatch);
cmd.AddRange(ConcurrencyOptions);
cmd.AddRange(EventHubResourceOptions);
cmd.SetGroupedHelp(
new OptionGroup("Build Options", new List<Option> { overrideRequiredOption, packagenameNotReqOption, rootloggingpathOption, defaultscripttimeoutOption, batchJobMonitorTimeoutMin, batchMonitorOption }),
new OptionGroup("DACPAC", new List<Option> { platinumdacpacOption, targetdacpacOption, forcecustomdacpacOption, platinumdbsourceOption, platinumserversourceOption }),
new OptionGroup("Settings File", SettingsFileExistingOptions),
new OptionGroup("Batch Settings", BatchSettingsOptions),
new OptionGroup("Batch Compute", BatchComputeOptions),
new OptionGroup("Authentication", DatabaseAuthArgs),
new OptionGroup("Connections & Secrets", ConnectionAndSecretsOptionsForBatch),
new OptionGroup("Identity", IdentityArgumentsForBatch),
new OptionGroup("Concurrency", ConcurrencyOptions),
new OptionGroup("Event Hub", EventHubResourceOptions)
);
cmd.SetAction(async (parseResult, ct) => {
var cmdLine = CommandLineArgsBinder.Bind(parseResult);
var unittest = parseResult.GetValue(unitTestOption);
Expand Down Expand Up @@ -205,6 +217,16 @@ private static Command BatchSaveSettingsCommand
cmd.AddRange(IdentityArgumentsForBatch);
cmd.AddRange(ConcurrencyOptions);
cmd.AddRange(EventHubResourceOptions);
cmd.SetGroupedHelp(
new OptionGroup("Settings File", SettingsFileNewOptions),
new OptionGroup("Execution", new List<Option> { deletebatchjobOption, rootloggingpathOption, defaultscripttimeoutOption, timeoutretrycountOption, pollbatchpoolstatusOption, silentOption, cleartextOption }),
new OptionGroup("Batch Compute", BatchComputeOptions),
new OptionGroup("Authentication", DatabaseAuthArgs),
new OptionGroup("Connections & Secrets", ConnectionAndSecretsOptionsForBatch),
new OptionGroup("Identity", IdentityArgumentsForBatch),
new OptionGroup("Concurrency", ConcurrencyOptions),
new OptionGroup("Event Hub", EventHubResourceOptions)
);
cmd.SetAction((parseResult) => {
var cmdLine = CommandLineArgsBinder.Bind(parseResult);
var clearText = parseResult.GetValue(cleartextOption);
Expand Down Expand Up @@ -289,6 +311,17 @@ private static Command BatchQueryCommand
cmd.AddRange(ConnectionAndSecretsOptionsForBatch);
cmd.AddRange(IdentityArgumentsForBatch);
cmd.AddRange(ConcurrencyOptions);
cmd.SetGroupedHelp(
new OptionGroup("Query", new List<Option> { overrideRequiredOption, queryFileRequiredOption, outputFileRequiredOption, silentOption }),
new OptionGroup("Batch Settings", new List<Option> { deletebatchjobOption, jobnameOption, rootloggingpathOption, defaultscripttimeoutOption, batchMonitorOption }),
new OptionGroup("Settings File", SettingsFileExistingOptions),
new OptionGroup("Batch Compute", BatchComputeOptions),
new OptionGroup("Authentication", DatabaseAuthArgs),
new OptionGroup("Connections & Secrets", ConnectionAndSecretsOptionsForBatch),
new OptionGroup("Identity", IdentityArgumentsForBatch),
new OptionGroup("Concurrency", ConcurrencyOptions),
new OptionGroup("Event Hub", EventHubResourceOptions)
);
cmd.SetAction(async (parseResult, ct) => {
var cmdLine = CommandLineArgsBinder.Bind(parseResult);
var unittest = parseResult.GetValue(unitTestOption);
Expand Down
Loading
Loading