Unless your data has the distance information in it, which I suspect is not the case, you would have to calculate the distance and sort in code after the query. If you are using the Azure Maps Web SDK in your application you can use the atlas.math.getDistanceTo function to calculate the straight line distance to each location from an origin point. https://learn.microsoft.com/en-us/javascript/api/azure-maps-control/atlas.math?view=azure-maps-typescript-latest#getdistanceto-position---point--position---point--string---distanceunits-
If you want the straight line distance, without using Azure Maps, or in any programming language, the Haversine formula is the calculation for this: https://rosettacode.org/wiki/Haversine_formula
If you want driving distances instead of straight line distances, the Azure Maps Route matrix service could be used to calculate this. https://learn.microsoft.com/en-us/rest/api/maps/route/postroutematrix
Once you have distances for each location, sorting your results would be the same as sorting on any number value in your data. How this would be done would depending on the programming language you are using.