In this case, you should be able to get the url from the object returned by Publish-AzureServiceProject.  It's possible this test will run against service endpoints other than production azure, and the url for these may not be in the cloudapp.net domain.  The value returned from Puvblish-AzureServiceProject is always correct.