DevOps Best Practices (AZ‐400) - amitbhilagude/userfullinks GitHub Wiki
Analysing Metrics in Azure
Create a Dashboard and Check Metrics in Azure Monitor
Set Application Health Endpoints into Azure Application Insights Availability test. Further, Create alerts or Actions on those tests
Create baseline metrics. The best way to start the Baseline metrics is to go though Azure Monitor Insights, E.g. Application that has an App insights dashboard, Go through individual resources, etc.
Use the above baseline Metric for performance testing to see the difference.
Azure Monitor and App insights allow you to set a different alert. Those alerts can be static and dynamic. Static alert has a fixed value e.g. CPU goes higher with % trigger the alert however dynamic uses Machine learning and detects automatically when to set the alert.
Azure Monitor also has smart detection feature to give a recommendation based on the machine learning
Azure Application insights support dependency map can help to find out all calls from different system and failure rate
Source Control Strategy
Two Options Github and TFVC. Recommended is Github
Repository sharing with Submodules: Submodules is best option in case you need to reused another repo e.g. Build script is one repo and every repo needs it then you create submodule
Branching strategy
Policies must be set in terms reviewer, restrictions etc.
Three options for Branching strategy: Trunk based, Feature(Task) based and release based. First one is used for small team, second one is good for CI\CD and medium size, third one is good for large team which different code per customer.
Repository Strategy
Handling Large repository
Branch policies and Security
Branch lock and restrictions
Rollback or reset is reset particular commit which will overwrite all above commits and you will never see them again in history
If the branch is deleted, you can restore it but the only way to restore it to search with the exact name.
Versioning Strategy
Use of semantic versioning Major.Minor.patch-tag
Build Pipeline Automation
Recommended tools for security scanning checkmark or Snyk or WhiteSource Bolt or Black duck
Test automation Unit testing, functional testing e.g. Individual microservice, Integration testing and UI testing using salenium
Code coverage. Available in Visual Studio as well as tasks in the Build pipeline in C#. An alternate option is sonarqube
The Health Status of the build pipeline will be monitored using built-in charts
Pipeline performance can be improved by enabling caching.
Cost vs Efficiency: A cost optimization solution could be having minimal agents however that will make the developer idle as pipelines will stay in a queue. so the preferred option is to have multiple agents which will reduce the time and improve the efficiency.
The best practice to have YAML template created and store in same or other repository which can be used by multiple pipelines
Create a variable group that can be used in multiple pipelines. It will have keyvault secret integration feature.
Build and package deployment can be included into Same pipeline with different stages.
Use of Azure Policy to enforce compliance in Azure e.g. naming convention, tags, etc.
Deployment Scripts and Template
ARM template vs Terraform :
The ARM template is Azure Specific. Terraform is for multiple cloud provider
Provisioning the latest resource is always available in ARM but Terraform may not have immediately.
Terraform maintains state but ARM template is not.
Terraform has clean up commands. ARM template doesn't have clean up commands
Bicep
Human readable markup of ARM template
Internally it converts this mark up into ARM template only before converting to ARM.
Include common checks e.g. ARM template JSON validation using linting added into build pipeline
Multiple options for creating SQL DB through Azure Pipeline e.g. SQL scripts or DACPAC (File can be exported from SQL)
Release Pipeline
Release pipeline supported Gated deployment and Approval
It is a good option instead of adding into YAML. The version and history of release pipeline is manged through Azure DevOps.
Azure App configuration: Recommended option for Centralised settings(Key-Value pair) and Feature toggle.Feature toggle support different target like group of people, % etc. Integration of feature flag will take care it automatically.
Release gates and Approval: Couple of pre and post condition can be applied and allow to approve the stage
Managing sensitive information in Automation
Service Principal
System Identity and Managed Identity
Store secrets in Key vaults and integrate Key vault in Build pipeline with below option
Use of Variable Group
Read secrets directly from Key vault in Pipeline
Create plain text secret and lock it in Azure DevOps
Creating service connection and manage the permission for that service connection
Two options: As part of CI, use of different tools mentioned above which is active test and nightly build which will become passive test
Compliance Scanning
Sonarqube
Monitoring DevOps Environment
Azure Monitor: One place to see all Logs
Log Analytics: Use of Workspace to see logs. The workspace will be centralized per region or in the resource context which means you can only see data if you have access to the Resource
Azure Application Insights: APM tool to get more insight into application level like exception, request, AJAX call, etc. Distribution\End to end tracing will be done with the Correlation Id
Expected one instance per region for log analytics.