public void GetAndSetSensitiveSiteConfigs() { RunWebsiteTestScenario( (siteName, resourceGroupName, whpName, locationName, webSitesClient, resourcesClient) => { #region Get/Set Application settings const string settingName = "Application Setting1", settingValue = "Setting Value 1"; var appSetting = new StringDictionary { Properties = new Dictionary <string, string> { { settingName, settingValue } } }; var appSettingsResponse = webSitesClient.WebApps.UpdateApplicationSettings( resourceGroupName, siteName, appSetting); Assert.NotNull(appSettingsResponse); Assert.True(appSettingsResponse.Properties.Contains(new KeyValuePair <string, string>(settingName, settingValue))); appSettingsResponse = webSitesClient.WebApps.ListApplicationSettings(resourceGroupName, siteName); Assert.NotNull(appSettingsResponse); Assert.True(appSettingsResponse.Properties.Contains(new KeyValuePair <string, string>(settingName, settingValue))); #endregion Get/Set Application settings #region Get/Set Metadata const string metadataName = "Metadata 1", metadataValue = "Metadata Value 1"; var metadata = new StringDictionary { Properties = new Dictionary <string, string> { { metadataName, metadataValue } } }; var metadataResponse = webSitesClient.WebApps.UpdateMetadata( resourceGroupName, siteName, metadata); Assert.NotNull(metadataResponse); Assert.True(metadataResponse.Properties.Contains(new KeyValuePair <string, string>(metadataName, metadataValue))); metadataResponse = webSitesClient.WebApps.ListMetadata(resourceGroupName, siteName); Assert.NotNull(metadataResponse); Assert.True(metadataResponse.Properties.Contains(new KeyValuePair <string, string>(metadataName, metadataValue))); #endregion Get/Set Metadata #region Get/Set Connection strings const string connectionStringName = "ConnectionString 1", connectionStringValue = "ConnectionString Value 1"; var connStringValueTypePair = new ConnStringValueTypePair { Value = connectionStringValue, Type = ConnectionStringType.MySql }; var connectionStringResponse = webSitesClient.WebApps.UpdateConnectionStrings( resourceGroupName, siteName, new ConnectionStringDictionary { Properties = new Dictionary <string, ConnStringValueTypePair> { { connectionStringName, connStringValueTypePair } } }); Assert.NotNull(connectionStringResponse); Assert.True(connectionStringResponse.Properties.Contains(new KeyValuePair <string, ConnStringValueTypePair>(connectionStringName, connStringValueTypePair), new ConnectionStringComparer())); connectionStringResponse = webSitesClient.WebApps.ListConnectionStrings(resourceGroupName, siteName); Assert.NotNull(connectionStringResponse); Assert.True(connectionStringResponse.Properties.Contains(new KeyValuePair <string, ConnStringValueTypePair>(connectionStringName, connStringValueTypePair), new ConnectionStringComparer())); #endregion Get/Set Connection strings #region Get Publishing credentials var credentialsResponse = webSitesClient.WebApps.ListPublishingCredentials(resourceGroupName, siteName); Assert.NotNull(credentialsResponse); Assert.Equal("$" + siteName, credentialsResponse.PublishingUserName); Assert.NotNull(credentialsResponse.PublishingPassword); #endregion Get Publishing credentials #region Get Publishing profile XML var publishingProfileResponse = webSitesClient.WebApps.ListPublishingProfileXmlWithSecrets(resourceGroupName, siteName, new CsmPublishingProfileOptions() { Format = "WebDeploy" }); Assert.NotNull(publishingProfileResponse); var doc = XDocument.Load(publishingProfileResponse, LoadOptions.None); Assert.NotNull(doc); #endregion Get Publishing profile XML webSitesClient.WebApps.Delete(resourceGroupName, siteName, deleteMetrics: true); webSitesClient.AppServicePlans.Delete(resourceGroupName, whpName); }); }
///GENMHASH:45A4D243BCC3EB6FA01DA00F52FDF305:425D09AC93B7A17B1A16F0D028F706A2 internal ConnectionStringImpl(string name, ConnStringValueTypePair valueTypePair, bool sticky) { this.name = name; this.valueTypePair = valueTypePair; this.sticky = sticky; }