Affinity groups ensure that resources created within the same affinity group are physically hosted by servers that are close together, enabling these resources to communicate quicker.
As a result of the various architectural improvements, affinity groups are no longer recommended in Azure.