Introduction
At this point, you can deploy Azure resources (i.e. Apps, Database etc.) using bicep parameter file that you've created in the previous step.
Deploying Process
You can deploy resources using Azure CLI. Go to Azure.IaC folder (Please contact us for it). Open powershell.
To login, run following command, choose your Azure Entra ID (Active directory) user.
az login
Then, run following command (please use your resource group name and bicep parameter file name)
az deployment group create --name IlapAnalyticsDeployment --resource-group 'your-resource-group-name' --template-file main.bicep --parameters your_param_file_name.bicepparam
Grant access to applications to use SQL Databases. For each database, sign in using Microsoft Entra authentication to the database and run the script below after replacing the user name. You need to do that for both analytcis API and background job app.
create user [name of your deployed app] from external provider
--Grant roles required to read/write and perform migrations from Entity Framework
alter role [db_datareader] add member [name of your deployed app]
go
alter role [db_datawriter] add member [name of your deployed app]
go
alter role [db_ddladmin] add member [name of your deployed app]
go
--Grant execute permissions to application
--Create the role
CREATE ROLE db_executor;
GO
--Grant EXECUTE permission on the entire database to the role
GRANT EXECUTE TO db_executor;
GO
-- Add a user to the role (replace with app service name)
alter role [db_executor] add member [name of your deployed app]
GO
Avoid SQL Server Timeout Issues Due to Deadlock
When performing large numbers of database operations, you may encounter timeout issues related to SQL Server deadlocks (known issue).
To mitigate this issue, adjust MAXDOP (see official guide) for your SQL Server or database to achieve optimal parallelism while avoiding deadlocks. The recommended setting is to set MAXDOP to an odd value.
1. Check how many cores your SQL Server has
SELECT
cpu_count AS logical_cpus,
socket_count,
cores_per_socket,
numa_node_count
FROM sys.dm_os_sys_info;
2. Pick a MAXDOP value
Use the table below to choose an appropriate odd MAXDOP value based on your core count. The value must be greater than 0 and should generally not exceed 8.
| Logical CPU count | Recommended MAXDOP |
|---|---|
| 2 | 1 |
| 4 | 3 |
| 6–8 | 5 |
| 10–16 | 7 |
| 18+ | 7 |
Rule of thumb: Set MAXDOP to
Number_of_cores - 1(rounded down to the nearest odd number), with a maximum of 7.
3. See current MAXDOP value
USE [YOUR_DATABASE_NAME];
SELECT name, value
FROM sys.database_scoped_configurations
WHERE name = 'MAXDOP';
4. Set MAXDOP
USE [YOUR_DATABASE_NAME];
ALTER DATABASE SCOPED CONFIGURATION SET MAXDOP = 7; -- Replace 7 with the value from the table above
Important: MAXDOP must be an integer greater than 0. A value of 0 will cause errors.
Please, do the same for the archive database as well.
Tips for a Successful Deployment
Ensure your Azure CLI is updated to the latest version. You can check by running:
az --versionVerify the resource group exists in your Azure subscription before deploying.
Check the main.bicep file and parameter file for typos or missing values.
What Happens After Deployment
- The deployment process will create the necessary Azure resources, including App Services, SQL Databases, and any additional resources defined in the Bicep file.
- You can monitor the deployment progress directly in the Azure Portal under Resource Groups > Deployments.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article