
If you’re a developer, DevOps newbie, or accidental tech lead just trying to ship something that works — this is for you.
Step 1: Start Simple
Before you go full microservices and multi-stage releases, do yourself a favor: start small.
- Go to your Azure DevOps organization.
- Create a new project — name it something you won’t hate in six months.
- In the Pipelines section, click “Create Pipeline.”
- Choose your code repository (Azure Repos, GitHub, Bitbucket, whatever you’re using).
- When it asks about YAML vs. Classic, choose YAML. It’s worth learning, I promise.
Step 2: Create Your First Working YAML Pipeline
Here’s a basic one for a .NET Core app. Just copy, paste, and edit as needed:
trigger:
- main
pool:
vmImage: 'ubuntu-latest'
steps:
- task: UseDotNet@2
inputs:
packageType: 'sdk'
version: '7.0.x'
- script: dotnet build --configuration Release
displayName: 'Build project'
- script: dotnet test --no-build --verbosity normal
displayName: 'Run tests'Why this works:
- It triggers on every push to the main.
- It sets up a clean environment each time (ubuntu-latest).
- It installs the right .NET SDK and runs a build + test cycle.
Step 3: Add CD
Once you’ve got your code building reliably, it’s time to deploy. Azure makes this easier than most platforms — but it’s still a few steps.
To deploy to Azure App Service:
- Create a service connection to your Azure account (under Project Settings > Service Connections).
- Add this to your YAML.
- task: AzureWebApp@1
inputs:
azureSubscription: 'Your-Service-Connection-Name'
appType: 'webApp'
appName: 'your-app-service-name'
package: '$(System.DefaultWorkingDirectory)/**/*.zip'You’ll need to zip your app as an artifact. Add this step before the deployment:
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/app.zip'
replaceExistingArchive: trueStep 4: Fix What Breaks
No CI/CD pipeline is born perfect. A few lessons I learned the hard way:
- YAML spacing is sacred. A single space off, and nothing works. Use a good linter or VS Code extension.
- Permissions can be weird. Your pipeline may fail silently because it doesn’t have to deploy rights. Check the service connection and give it access to the resource group.
- Secrets are not environment variables. Use Azure Key Vault or pipeline secrets for anything sensitive. Don’t hardcode.
Tips From the Experts
- Write comments in your YAML. Future you will thank you.
- Use templates if you manage multiple pipelines — reuse your work like a smart human.
- Name your pipeline that runs clearly. Use the name:
'$(Build.DefinitionName)_$(Date:yyyyMMdd)$(Rev:.r)' to avoid endless "Build "#.- Don’t build every branch. Be selective with your trigger — save those build minutes.
Progress Over Perfection
Your first Azure DevOps pipeline won’t be perfect. It doesn’t need to be. What matters is that you start — push some code, see it build, deploy it, and feel that sweet rush of automation. You’ll improve it over time. After some sometime, when you’ll look back and laugh at how wild this all seemed.
No comments:
Post a Comment