Socialize

Tuesday, October 21, 2025

🧩 What Are Artifacts in Azure DevOps? (Complete Guide with Real-Time Examples)

 🚀 Introduction

In a CI/CD (Continuous Integration/Continuous Deployment) pipeline, build outputs like .dll, .exe, .zip, or .nupkg files need to be stored, shared, and used by later stages — such as testing or deployment.

These outputs are called Artifacts.

In Azure DevOps, Artifacts act as a bridge between the build and release pipelines, allowing teams to store, version, and distribute build outputs efficiently.


🧠 What is an Artifact in Azure DevOps?

An Artifact in Azure DevOps is any file or package produced during the build process that you want to save for later use — such as in deployment, testing, or distribution.

When a build pipeline completes, it can publish its output (e.g., binaries, reports, zip files) as Build Artifacts, which are then consumed by Release Pipelines or other stages.


⚙️ Types of Artifacts in Azure DevOps

Azure DevOps supports multiple types of artifacts:

1. Build Artifacts

  • Generated from a build pipeline.

  • Used to transfer build outputs to a release pipeline.

  • Example: Compiled .dll files, web app .zip, test reports, etc.

2. Pipeline Artifacts

  • Newer, faster, and more efficient than legacy build artifacts.

  • Stored in Azure DevOps and linked directly to the pipeline run.

  • Supports caching and is optimized for large files.

3. Azure Artifacts (Package Feeds)

  • A package management system integrated into Azure DevOps.

  • Supports NuGet, npm, Maven, Python, and Universal Packages.

  • Helps developers share libraries or dependencies across projects.


💡 Real-Time Example: Build to Release Flow

Let’s imagine a .NET Core web application that’s being built and deployed using Azure DevOps.

🔹 Step 1: Build Pipeline

The build pipeline compiles the code, runs tests, and creates a .zip file for deployment.

- task: DotNetCoreCLI@2 inputs: command: 'publish' publishWebProjects: true arguments: '--configuration Release --output $(Build.ArtifactStagingDirectory)' - task: PublishBuildArtifacts@1 inputs: pathToPublish: '$(Build.ArtifactStagingDirectory)' artifactName: 'WebAppBuild'

👉 This will generate and store the build output as an artifact named “WebAppBuild”.


🔹 Step 2: Release Pipeline

The release pipeline picks up the published artifact (WebAppBuild.zip) and deploys it to Azure App Service.

- stage: Deploy jobs: - deployment: DeployWebApp environment: 'Production' strategy: runOnce: deploy: steps: - download: current artifact: WebAppBuild - task: AzureWebApp@1 inputs: azureSubscription: 'MyAzureConnection' appName: 'mywebapp-prod' package: '$(Pipeline.Workspace)/WebAppBuild/*.zip'

✅ The artifact acts as the connector between Build and Release pipelines, ensuring the exact build output gets deployed.


📦 Azure Artifacts Feed Example

If you are building reusable libraries or packages, you can publish them to Azure Artifacts Feed instead of external sources.

Example: Publishing a NuGet Package.

- task: DotNetCoreCLI@2 inputs: command: 'pack' packagesToPack: '**/*.csproj' versioningScheme: 'off' - task: NuGetCommand@2 inputs: command: 'push' packagesToPush: '**/*.nupkg' publishVstsFeed: 'MyCompanyFeed'

✅ The .nupkg files will be published to your private Azure Artifacts feed, where developers can reuse them across multiple solutions.


🔍 Why Artifacts Are Important

BenefitDescription
ConsistencyEnsures the same build output is used across test, staging, and production environments.
VersioningEach artifact is tied to a specific pipeline run and build version.
ReusabilityShared components or libraries can be reused via Azure Artifacts feed.
TraceabilityEasy to track which build version was deployed where.
AutomationSimplifies the flow between CI (build) and CD (release).

🧩 Difference Between Build Artifacts and Azure Artifacts Feed

FeatureBuild/Pipeline ArtifactsAzure Artifacts Feed
PurposeStore build outputsManage reusable packages
UsageUsed between build and releaseUsed across multiple projects
Example.zip, .dll, .exe.nupkg, .npm, .jar
RetentionShort-term storage (build-related)Long-term package management
IntegrationCI/CD pipelinesDeveloper environment & pipelines

🏁 Summary

  • Artifacts in Azure DevOps represent the output of a build or reusable package for other stages in a pipeline.

  • They enable smooth transitions between CI and CD stages, ensuring consistent and reliable deployments.

  • Use Build/Pipeline Artifacts for deployment packages, and Azure Artifacts Feeds for library sharing and dependency management.

Monday, October 20, 2025

🧠 Difference Between Functions, Stored Procedures, and Views in SQL Server

 📘 Introduction

In SQL Server, Functions, Stored Procedures, and Views are three powerful components that simplify database programming and improve performance.
Although they look similar in some ways, their purpose, behavior, and execution are quite different.

Let’s understand each in detail with real-world examples and learn when to use them.


🔹 What is a Function in SQL Server?

A Function in SQL Server is a reusable block of code that performs a specific task and returns a value. Functions are mainly used for calculations, data formatting, and reusable logic inside queries.

✅ Key Features:

  • Must return a value (scalar or table).

  • Cannot perform INSERT, UPDATE, or DELETE operations on database tables.

  • Can be called inside a SELECT statement.

  • Cannot use transactions.

🧩 Types of Functions:

  1. Scalar Function: Returns a single value.

  2. Table-Valued Function: Returns a table.

💡 Real-Time Example:

Suppose your e-commerce database needs to calculate the total price including tax for each product.

CREATE FUNCTION dbo.fn_GetTotalPrice(@Price DECIMAL(10,2), @Tax DECIMAL(5,2)) RETURNS DECIMAL(10,2) AS BEGIN RETURN @Price + (@Price * @Tax / 100) END;

Now, you can call this function inside a query:

SELECT ProductName, dbo.fn_GetTotalPrice(Price, 18) AS TotalPrice FROM Products;

👉 Use Case: Best used for reusable calculations and logic that needs to return a value in queries.


🔹 What is a Stored Procedure in SQL Server?

A Stored Procedure is a precompiled collection of SQL statements that perform one or more database operations.
It can insert, update, delete, or retrieve data, and also handle complex business logic.

✅ Key Features:

  • Can return multiple result sets.

  • Supports transactions and error handling.

  • Can modify data in tables.

  • Can accept input, output, and return parameters.

  • Improves performance due to precompilation and execution plan reuse.

💡 Real-Time Example:

Let’s say you want to add a new customer into your CRM database.

CREATE PROCEDURE dbo.sp_AddCustomer @CustomerName NVARCHAR(100), @Email NVARCHAR(100), @City NVARCHAR(50) AS BEGIN INSERT INTO Customers (CustomerName, Email, City) VALUES (@CustomerName, @Email, @City); SELECT 'Customer added successfully' AS Message; END;

Execute the stored procedure:

EXEC dbo.sp_AddCustomer 'John Doe', 'john@example.com', 'Hyderabad';

👉 Use Case: Best for performing multiple DML operations (Insert, Update, Delete) or complex business transactions.


🔹 What is a View in SQL Server?

A View is a virtual table that displays data from one or more tables through a SQL query.
It doesn’t store data physically — it simply saves a SQL query for easy reuse.

✅ Key Features:

  • Simplifies complex joins and queries.

  • Provides data security by restricting access to specific columns or rows.

  • Can be updated if it’s based on a single table.

  • Improves data abstraction.

💡 Real-Time Example:

Suppose you have a Sales table and a Customer table. You can create a View to easily get the Customer Sales Summary.

CREATE VIEW vw_CustomerSales AS SELECT c.CustomerName, SUM(s.TotalAmount) AS TotalSales FROM Customers c JOIN Sales s ON c.CustomerID = s.CustomerID GROUP BY c.CustomerName;

Now, just query the View like a table:

SELECT * FROM vw_CustomerSales;

👉 Use Case: Best for reporting, data analysis, and abstracting complex joins.


⚖️ Comparison Table: Functions vs Stored Procedures vs Views

FeatureFunctionStored ProcedureView
Returns ValueYes (Scalar/Table)OptionalActs as a virtual table
Can Modify Data❌ No✅ YesLimited (if single table)
Can Use Transactions❌ No✅ Yes❌ No
Used Inside SELECT✅ Yes❌ No✅ Yes
PerformanceHigh for calculationsHigh for large operationsMedium
ReusabilityHighHighHigh
CompilationCompiled each timePrecompiledNot compiled (query-based)

🧠 Real-World Scenario: E-Commerce Example

RequirementBest ChoiceReason
Calculate product discountFunctionReturns computed value
Insert new order & update stockStored ProcedurePerforms multiple DML operations
Generate monthly sales reportViewSimplifies query for reporting tools

🚀 Best Practices

  1. Use Functions for small, reusable logic that doesn’t modify data.

  2. Use Stored Procedures for complex business workflows.

  3. Use Views to simplify data access and improve query readability.

  4. Avoid heavy logic inside Views — use Indexed Views for performance if needed.

  5. Combine all three effectively for a clean database architecture.


🏁 Conclusion

Understanding the differences between Functions, Stored Procedures, and Views in SQL Server helps developers design efficient, modular, and maintainable databases.
Each component has its strengths — use them wisely to balance performance, reusability, and security.

Blog Archive

Don't Copy

Protected by Copyscape Online Plagiarism Checker

Pages