Environments at its core is a grouping of resources, the resources themselves represent actual deployment targets. Roughly types are environment are Development, Test, PreProduction and Production.
Within Azure pipelines there are number of things you can achive using environments.
Track deployment history
Keep track deployments done seperatly in different environments. Deployment job run history for perticular environment can be tracked under the selected environment. Drilling down the history provides details about commits and workitems.
A deployment can address a single environment at at time, only impacting those resources which are part of the environment. It can also target a particular resource in an environment.
Controlling access to the Environment
We can control who can create, view, use and manage the environment with user permissions and roles. Various roles available are Creator-who can create environments, Reader - can only view environments, User - can only user environment while authorizing pipeline and Administrator - who can administer the environment and grant access.
Access to pipelines can be also controlled, default is open access which needs to be changed to Restricted.
Approvals and Checks during deployment process
Approval step can be added to control the deployment process. Single or multiple people can approve or reject the release. Similarly various checks such as artifact evaluation and go ahead based on monitoring alert is also possible.
Limitations: Currently DevOps environments supports only Virtual Machines and Kubernetes as resources.
An environment is a collection of resources that can be targeted by deployments from a pipeline. Environments can include Kubernetes clusters, Azure web apps, virtual machines, databases