public IAzureEnvironment RemoveEnvironment(string name) { if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException("name", AuthenticationMessages.EnvironmentNameNeedsToBeSpecified); } if (AzureEnvironment.PublicEnvironments.ContainsKey(name)) { throw new ArgumentException(AuthenticationMessages.RemovingDefaultEnvironmentsNotSupported, "name"); } IAzureEnvironment environment; if (_profile.TryRemoveEnvironment(name, out environment)) { return(environment); } else { throw new ArgumentException(string.Format(AuthenticationMessages.EnvironmentNotFound, name), "name"); } }