public static void SaveUserAccount(AzureAccount account) { if (!Directory.Exists(GetELearningLabStoragePath())) { Directory.CreateDirectory(GetELearningLabStoragePath()); } Dictionary <string, string> user = new Dictionary <string, string>() { { "endpoint", account.GetRegion() }, { "key", account.GetKey() } }; XElement root = new XElement("user", from kv in user select new XElement(kv.Key, kv.Value)); FileStream file = File.Open(GetAccessKeyFilePath(), FileMode.OpenOrCreate); root.Save(file); file.Close(); }