Forum Discussion
On Premise DevOps 2022 CI/CD pipeline to Host Application on IIS
Hi All,
We have deployed DevOps 2022 server on our On-Premise server which we upgraded from TFS 2018. I would like to know the steps about Build and Release pipeline which can auto deploy application on my IIS server. We have around 15 Projects deployed in new DevOps server and all our developers are doing source code check in and check out. Below is my setup details and development technology used in my company.
1. Active Directory Environment. (Separate AD server)
2. DevOps Server 2022 Installed on Physical Sever. ( Domain Joined)
3. Physical Test Server having IIS configured.
4. Physical SQL database server.
5. Development is on ASP .NET Core, Angular, and ASP .Net
6. Developers having Visual Studio 2019 and Visual 2012 Professional Edition. ( 15 Developers)
Need your help in setting up a complete automated process.
Regards
Imran Shaikh
Hi Imransh21,
Based on the information you've provided I would approach it in the following way:
CI/CD Pipeline for IIS Deployment
Prerequisites
- Active Directory Environment: Ensure your servers are part of the Active Directory domain.
- DevOps Server 2022: Installed and configured on your on-premise server.
- IIS Server: Ensure IIS is installed and configured on your test server.
- SQL Server: Ensure your SQL server is up and running.
- Development Tools: Ensure developers have Visual Studio 2019/2012 configured.
Step 1: Configure the Build Agent
Install the Azure Pipelines Agent:
- Download the agent from your Azure DevOps Server. Go to your Azure DevOps Server, navigate to your project, and select Project settings > Agent pools.
- Select the default pool (or create a new one), then select New agent.
- Follow the instructions to download and configure the agent on the server where you want to run builds.
Configure the Agent:
- Run the downloaded agent package and follow the setup wizard.
- Ensure the agent is running as a service and connected to the correct project and agent pool.
Step 2: Create a Build Pipeline
Define the Build Pipeline:
- Go to your DevOps project and navigate to Pipelines > New pipeline.
- Select Classic Editor to create a pipeline without YAML.
- Choose your repository and select Continue.
- Select the ASP.NET Core template (or a relevant template based on your project).
Configure Build Steps:
- Restore NuGet Packages: Add a task to restore NuGet packages.
- Build Solution: Add a task to build your solution. Ensure you specify the correct solution file path.
- Run Tests: If you have unit tests, add a task to run these tests.
- Publish Build Artifacts: Add a task to publish build artifacts. Set the path to publish (e.g., $(Build.ArtifactStagingDirectory)).
Save and Queue the Build:
- Save the build pipeline and run it to ensure it completes successfully.
Step 3: Create a Release Pipeline
Define the Release Pipeline:
- Navigate to Releases under Pipelines, then select New pipeline.
- Choose an empty job template.
Add an Artifact:
- Link the build pipeline you created as the source for the release.
Define Stages:
- Add a stage for deployment (e.g., IIS Deployment).
- In the Tasks tab, add the following tasks:
Step 4: Deploy to IIS
Copy Files:
- Add a Copy Files task to copy files from the build artifact to the IIS server.
- Source Folder: $(System.DefaultWorkingDirectory)/_yourbuildpipeline/build
- Contents: **
- Target Folder: \\yourIISServer\c$\inetpub\wwwroot\yourapp
- Add a Copy Files task to copy files from the build artifact to the IIS server.
Deploy using IIS Web App Deployment:
- Add an IIS Web App Deployment task:
- Package or Folder: $(System.DefaultWorkingDirectory)/_yourbuildpipeline/build
- Web App Name: Your IIS site name.
- Remove Additional Files at Destination: Checked.
- Add an IIS Web App Deployment task:
Step 5: Configure IIS and SQL Server
IIS Configuration:
- Ensure the application pool and site are configured in IIS.
- Set appropriate permissions for the deployment account.
SQL Server Configuration:
- Ensure connection strings in your application configuration point to the correct SQL Server instance.
- Verify that the database is accessible from the IIS server.
Step 6: Automate the Process
- Continuous Integration:
- Set up triggers in the build pipeline to trigger a build on every code check-in.
- Continuous Deployment:
- Set up triggers in the release pipeline to deploy automatically after a successful build.
Step 7: Test and Monitor
Test Deployment:
- Test the deployment to ensure the application is correctly deployed and running on the IIS server.
Monitor:
- Use Azure Monitor or other monitoring tools to keep track of build and deployment processes.
I hope this will help you with your pipeline
Best regards,
Daniel
This is NOT 100% match but worth to take a look:
https://medium.com/multinetinventiv/creating-build-and-release-pipeline-in-azure-devops-6d80180a2cd0
- DTBIron Contributor
Hi Imransh21,
Based on the information you've provided I would approach it in the following way:
CI/CD Pipeline for IIS Deployment
Prerequisites
- Active Directory Environment: Ensure your servers are part of the Active Directory domain.
- DevOps Server 2022: Installed and configured on your on-premise server.
- IIS Server: Ensure IIS is installed and configured on your test server.
- SQL Server: Ensure your SQL server is up and running.
- Development Tools: Ensure developers have Visual Studio 2019/2012 configured.
Step 1: Configure the Build Agent
Install the Azure Pipelines Agent:
- Download the agent from your Azure DevOps Server. Go to your Azure DevOps Server, navigate to your project, and select Project settings > Agent pools.
- Select the default pool (or create a new one), then select New agent.
- Follow the instructions to download and configure the agent on the server where you want to run builds.
Configure the Agent:
- Run the downloaded agent package and follow the setup wizard.
- Ensure the agent is running as a service and connected to the correct project and agent pool.
Step 2: Create a Build Pipeline
Define the Build Pipeline:
- Go to your DevOps project and navigate to Pipelines > New pipeline.
- Select Classic Editor to create a pipeline without YAML.
- Choose your repository and select Continue.
- Select the ASP.NET Core template (or a relevant template based on your project).
Configure Build Steps:
- Restore NuGet Packages: Add a task to restore NuGet packages.
- Build Solution: Add a task to build your solution. Ensure you specify the correct solution file path.
- Run Tests: If you have unit tests, add a task to run these tests.
- Publish Build Artifacts: Add a task to publish build artifacts. Set the path to publish (e.g., $(Build.ArtifactStagingDirectory)).
Save and Queue the Build:
- Save the build pipeline and run it to ensure it completes successfully.
Step 3: Create a Release Pipeline
Define the Release Pipeline:
- Navigate to Releases under Pipelines, then select New pipeline.
- Choose an empty job template.
Add an Artifact:
- Link the build pipeline you created as the source for the release.
Define Stages:
- Add a stage for deployment (e.g., IIS Deployment).
- In the Tasks tab, add the following tasks:
Step 4: Deploy to IIS
Copy Files:
- Add a Copy Files task to copy files from the build artifact to the IIS server.
- Source Folder: $(System.DefaultWorkingDirectory)/_yourbuildpipeline/build
- Contents: **
- Target Folder: \\yourIISServer\c$\inetpub\wwwroot\yourapp
- Add a Copy Files task to copy files from the build artifact to the IIS server.
Deploy using IIS Web App Deployment:
- Add an IIS Web App Deployment task:
- Package or Folder: $(System.DefaultWorkingDirectory)/_yourbuildpipeline/build
- Web App Name: Your IIS site name.
- Remove Additional Files at Destination: Checked.
- Add an IIS Web App Deployment task:
Step 5: Configure IIS and SQL Server
IIS Configuration:
- Ensure the application pool and site are configured in IIS.
- Set appropriate permissions for the deployment account.
SQL Server Configuration:
- Ensure connection strings in your application configuration point to the correct SQL Server instance.
- Verify that the database is accessible from the IIS server.
Step 6: Automate the Process
- Continuous Integration:
- Set up triggers in the build pipeline to trigger a build on every code check-in.
- Continuous Deployment:
- Set up triggers in the release pipeline to deploy automatically after a successful build.
Step 7: Test and Monitor
Test Deployment:
- Test the deployment to ensure the application is correctly deployed and running on the IIS server.
Monitor:
- Use Azure Monitor or other monitoring tools to keep track of build and deployment processes.
I hope this will help you with your pipeline
Best regards,
Daniel