コード例 #1
0
        public static AzureStoragePropertyDictionaryResource ConvertToAzureStorageAccountPathPropertyDictionary(this WebAppAzureStoragePath[] webAppAzureStorageProperties)
        {
            if (webAppAzureStorageProperties == null)
            {
                return(null);
            }
            AzureStoragePropertyDictionaryResource result = new AzureStoragePropertyDictionaryResource();

            result.Properties = new Dictionary <string, AzureStorageInfoValue>();
            foreach (var item in webAppAzureStorageProperties)
            {
                result.Properties.Add(
                    new KeyValuePair <string, AzureStorageInfoValue>(
                        item.Name,
                        new AzureStorageInfoValue(
                            item.Type,
                            item.AccountName,
                            item.ShareName,
                            item.AccessKey,
                            item.MountPath)));
            }

            return(result);
        }
コード例 #2
0
        public void UpdateWebAppConfiguration(string resourceGroupName, string location, string webSiteName, string slotName, SiteConfig siteConfig = null, IDictionary <string, string> appSettings = null, IDictionary <string, ConnStringValueTypePair> connectionStrings = null, AzureStoragePropertyDictionaryResource azureStorageSettings = null)
        {
            string qualifiedSiteName;
            var    useSlot = CmdletHelpers.ShouldUseDeploymentSlot(webSiteName, slotName, out qualifiedSiteName);

            if (useSlot)
            {
                if (appSettings != null)
                {
                    WrappedWebsitesClient.WebApps().UpdateApplicationSettingsSlot(
                        resourceGroupName,
                        webSiteName,
                        new StringDictionary {
                        Properties = appSettings
                    },
                        slotName);
                }

                if (siteConfig != null)
                {
                    WrappedWebsitesClient.WebApps().UpdateConfigurationSlot(
                        resourceGroupName,
                        webSiteName,
                        siteConfig.ConvertToSiteConfigResource(),
                        slotName);
                }

                if (connectionStrings != null)
                {
                    WrappedWebsitesClient.WebApps().UpdateConnectionStringsSlot(
                        resourceGroupName,
                        webSiteName,
                        new ConnectionStringDictionary {
                        Properties = connectionStrings
                    },
                        slotName);
                }

                if (azureStorageSettings != null)
                {
                    WrappedWebsitesClient.WebApps().UpdateAzureStorageAccountsSlot(
                        resourceGroupName,
                        webSiteName,
                        azureStorageSettings,
                        slotName);
                }
            }
            else
            {
                if (appSettings != null)
                {
                    WrappedWebsitesClient.WebApps().UpdateApplicationSettings(
                        resourceGroupName,
                        webSiteName,
                        new StringDictionary {
                        Properties = appSettings
                    });
                }

                if (siteConfig != null)
                {
                    WrappedWebsitesClient.WebApps().UpdateConfiguration(resourceGroupName, webSiteName, siteConfig.ConvertToSiteConfigResource());
                }

                if (connectionStrings != null)
                {
                    WrappedWebsitesClient.WebApps().UpdateConnectionStrings(
                        resourceGroupName,
                        webSiteName,
                        new ConnectionStringDictionary {
                        Properties = connectionStrings
                    });
                }

                if (azureStorageSettings != null)
                {
                    WrappedWebsitesClient.WebApps().UpdateAzureStorageAccounts(
                        resourceGroupName,
                        webSiteName,
                        azureStorageSettings);
                }
            }
        }