These are all domain names and DNS servers are used to resolve these to different IPs.
These are all subdomain names. And subdomains can point to a different IP, or they can point to the same IP. They can also use a CNAME record to point to another [sub]domain name, and it’s probably most common to have an A record on the main domain with the IP and just use a CNAME on the www subdomain so that it always points to the same place the main domain points.
DNS does not know anything about http or https or any other protocal like that. It just resolves the domain name to an IP/set of IPs. The only thing it can do is point www.microsoft.com and microsoft.com to the same location so that you can use either to get to the webservers.
CNAME is the record that is used to point e.g. www.microsoft.com to microsoft.com. They could use an A record for www.microsoft.com and use the same IP as the A record for microsoft.com, which would accomplish the same thing, but would have to be updated when the IP for microsoft.com changes.
These are all subdomain names. And subdomains can point to a different IP, or they can point to the same IP. They can also use a CNAME record to point to another [sub]domain name, and it’s probably most common to have an A record on the main domain with the IP and just use a CNAME on the www subdomain so that it always points to the same place the main domain points.
CNAME is the record that is used to point e.g. www.microsoft.com to microsoft.com. They could use an A record for www.microsoft.com and use the same IP as the A record for microsoft.com, which would accomplish the same thing, but would have to be updated when the IP for microsoft.com changes.