public Site CreateWebApp(string resourceGroupName, string webAppName, string slotName, string location, string serverFarmId, CloningInfo cloningInfo)
        {
            Site createdWebSite = null;
            string qualifiedSiteName;
            if (CmdletHelpers.ShouldUseDeploymentSlot(webAppName, slotName, out qualifiedSiteName))
            {
                createdWebSite = WrappedWebsitesClient.Sites.CreateOrUpdateSiteSlot(
                        resourceGroupName, webAppName, slot: slotName, siteEnvelope:
                        new Site
                        {
                            SiteName = qualifiedSiteName,
                            Location = location,
                            ServerFarmId = serverFarmId,
                            CloningInfo =  cloningInfo
                        });
            }
            else
            {
                createdWebSite = WrappedWebsitesClient.Sites.CreateOrUpdateSite(
                        resourceGroupName, webAppName, siteEnvelope:
                        new Site
                        {
                            SiteName = qualifiedSiteName,
                            Location = location,
                            ServerFarmId = serverFarmId,
                            CloningInfo = cloningInfo
                        });
            }

            GetWebAppConfiguration(resourceGroupName, webAppName, slotName, createdWebSite);
            return createdWebSite;
        }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the DeletedSite class.
 /// </summary>
 public DeletedSite(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary <string, string> tags = default(IDictionary <string, string>), DateTime?deletedTimestamp = default(DateTime?), string deletedSiteName = default(string), string state = default(string), IList <string> hostNames = default(IList <string>), string repositorySiteName = default(string), UsageState?usageState = default(UsageState?), bool?enabled = default(bool?), IList <string> enabledHostNames = default(IList <string>), SiteAvailabilityState?availabilityState = default(SiteAvailabilityState?), IList <HostNameSslState> hostNameSslStates = default(IList <HostNameSslState>), string serverFarmId = default(string), DateTime?lastModifiedTimeUtc = default(DateTime?), SiteConfig siteConfig = default(SiteConfig), IList <string> trafficManagerHostNames = default(IList <string>), bool?premiumAppDeployed = default(bool?), bool?scmSiteAlsoStopped = default(bool?), string targetSwapSlot = default(string), HostingEnvironmentProfile hostingEnvironmentProfile = default(HostingEnvironmentProfile), string microService = default(string), string gatewaySiteName = default(string), bool?clientAffinityEnabled = default(bool?), bool?clientCertEnabled = default(bool?), bool?hostNamesDisabled = default(bool?), string outboundIpAddresses = default(string), int?containerSize = default(int?), int?maxNumberOfWorkers = default(int?), CloningInfo cloningInfo = default(CloningInfo), string resourceGroup = default(string), bool?isDefaultContainer = default(bool?), string defaultHostName = default(string))
     : base(location, id, name, type, tags)
 {
     DeletedTimestamp          = deletedTimestamp;
     DeletedSiteName           = deletedSiteName;
     State                     = state;
     HostNames                 = hostNames;
     RepositorySiteName        = repositorySiteName;
     UsageState                = usageState;
     Enabled                   = enabled;
     EnabledHostNames          = enabledHostNames;
     AvailabilityState         = availabilityState;
     HostNameSslStates         = hostNameSslStates;
     ServerFarmId              = serverFarmId;
     LastModifiedTimeUtc       = lastModifiedTimeUtc;
     SiteConfig                = siteConfig;
     TrafficManagerHostNames   = trafficManagerHostNames;
     PremiumAppDeployed        = premiumAppDeployed;
     ScmSiteAlsoStopped        = scmSiteAlsoStopped;
     TargetSwapSlot            = targetSwapSlot;
     HostingEnvironmentProfile = hostingEnvironmentProfile;
     MicroService              = microService;
     GatewaySiteName           = gatewaySiteName;
     ClientAffinityEnabled     = clientAffinityEnabled;
     ClientCertEnabled         = clientCertEnabled;
     HostNamesDisabled         = hostNamesDisabled;
     OutboundIpAddresses       = outboundIpAddresses;
     ContainerSize             = containerSize;
     MaxNumberOfWorkers        = maxNumberOfWorkers;
     CloningInfo               = cloningInfo;
     ResourceGroup             = resourceGroup;
     IsDefaultContainer        = isDefaultContainer;
     DefaultHostName           = defaultHostName;
 }
Example #3
0
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public virtual void Validate()
 {
     if (SiteConfig != null)
     {
         SiteConfig.Validate();
     }
     if (CloningInfo != null)
     {
         CloningInfo.Validate();
     }
 }
Example #4
0
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public override void Validate()
 {
     base.Validate();
     if (SiteConfig != null)
     {
         SiteConfig.Validate();
     }
     if (CloningInfo != null)
     {
         CloningInfo.Validate();
     }
 }
Example #5
0
 /// <summary>
 /// Initializes a new instance of the Site class.
 /// </summary>
 /// <param name="location">Resource Location.</param>
 /// <param name="id">Resource Id.</param>
 /// <param name="name">Resource Name.</param>
 /// <param name="kind">Kind of resource.</param>
 /// <param name="type">Resource type.</param>
 /// <param name="tags">Resource tags.</param>
 /// <param name="state">Current state of the app.</param>
 /// <param name="hostNames">Hostnames associated with the app.</param>
 /// <param name="repositorySiteName">Name of the repository
 /// site.</param>
 /// <param name="usageState">State indicating whether the app has
 /// exceeded its quota usage. Read-only. Possible values include:
 /// 'Normal', 'Exceeded'</param>
 /// <param name="enabled">&lt;code&gt;true&lt;/code&gt; if the app is
 /// enabled; otherwise, &lt;code&gt;false&lt;/code&gt;. Setting this
 /// value to false disables the app (takes the app offline).</param>
 /// <param name="enabledHostNames">Enabled hostnames for the
 /// app.Hostnames need to be assigned (see HostNames) AND enabled.
 /// Otherwise,
 /// the app is not served on those hostnames.</param>
 /// <param name="availabilityState">Management information availability
 /// state for the app. Possible values include: 'Normal', 'Limited',
 /// 'DisasterRecoveryMode'</param>
 /// <param name="hostNameSslStates">Hostname SSL states are used to
 /// manage the SSL bindings for app's hostnames.</param>
 /// <param name="serverFarmId">Resource ID of the associated App
 /// Service plan, formatted as:
 /// "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}".</param>
 /// <param name="reserved">&lt;code&gt;true&lt;/code&gt; if reserved;
 /// otherwise, &lt;code&gt;false&lt;/code&gt;.</param>
 /// <param name="isXenon">Obsolete: Hyper-V sandbox.</param>
 /// <param name="hyperV">Hyper-V sandbox.</param>
 /// <param name="lastModifiedTimeUtc">Last time the app was modified,
 /// in UTC. Read-only.</param>
 /// <param name="siteConfig">Configuration of the app.</param>
 /// <param name="trafficManagerHostNames">Azure Traffic Manager
 /// hostnames associated with the app. Read-only.</param>
 /// <param name="scmSiteAlsoStopped">&lt;code&gt;true&lt;/code&gt; to
 /// stop SCM (KUDU) site when the app is stopped; otherwise,
 /// &lt;code&gt;false&lt;/code&gt;. The default is
 /// &lt;code&gt;false&lt;/code&gt;.</param>
 /// <param name="targetSwapSlot">Specifies which deployment slot this
 /// app will swap into. Read-only.</param>
 /// <param name="hostingEnvironmentProfile">App Service Environment to
 /// use for the app.</param>
 /// <param name="clientAffinityEnabled">&lt;code&gt;true&lt;/code&gt;
 /// to enable client affinity; &lt;code&gt;false&lt;/code&gt; to stop
 /// sending session affinity cookies, which route client requests in
 /// the same session to the same instance. Default is
 /// &lt;code&gt;true&lt;/code&gt;.</param>
 /// <param name="clientCertEnabled">&lt;code&gt;true&lt;/code&gt; to
 /// enable client certificate authentication (TLS mutual
 /// authentication); otherwise, &lt;code&gt;false&lt;/code&gt;. Default
 /// is &lt;code&gt;false&lt;/code&gt;.</param>
 /// <param name="clientCertMode">This composes with ClientCertEnabled
 /// setting.
 /// - ClientCertEnabled: false means ClientCert is ignored.
 /// - ClientCertEnabled: true and ClientCertMode: Required means
 /// ClientCert is required.
 /// - ClientCertEnabled: true and ClientCertMode: Optional means
 /// ClientCert is optional or accepted. Possible values include:
 /// 'Required', 'Optional', 'OptionalInteractiveUser'</param>
 /// <param name="clientCertExclusionPaths">client certificate
 /// authentication comma-separated exclusion paths</param>
 /// <param name="hostNamesDisabled">&lt;code&gt;true&lt;/code&gt; to
 /// disable the public hostnames of the app; otherwise,
 /// &lt;code&gt;false&lt;/code&gt;.
 /// If &lt;code&gt;true&lt;/code&gt;, the app is only accessible via
 /// API management process.</param>
 /// <param name="customDomainVerificationId">Unique identifier that
 /// verifies the custom domains assigned to the app. Customer will add
 /// this id to a txt record for verification.</param>
 /// <param name="outboundIpAddresses">List of IP addresses that the app
 /// uses for outbound connections (e.g. database access). Includes VIPs
 /// from tenants that site can be hosted with current settings.
 /// Read-only.</param>
 /// <param name="possibleOutboundIpAddresses">List of IP addresses that
 /// the app uses for outbound connections (e.g. database access).
 /// Includes VIPs from all tenants except dataComponent.
 /// Read-only.</param>
 /// <param name="containerSize">Size of the function container.</param>
 /// <param name="dailyMemoryTimeQuota">Maximum allowed daily
 /// memory-time quota (applicable on dynamic apps only).</param>
 /// <param name="suspendedTill">App suspended till in case memory-time
 /// quota is exceeded.</param>
 /// <param name="maxNumberOfWorkers">Maximum number of workers.
 /// This only applies to Functions container.</param>
 /// <param name="cloningInfo">If specified during app creation, the app
 /// is cloned from a source app.</param>
 /// <param name="resourceGroup">Name of the resource group the app
 /// belongs to. Read-only.</param>
 /// <param name="isDefaultContainer">&lt;code&gt;true&lt;/code&gt; if
 /// the app is a default container; otherwise,
 /// &lt;code&gt;false&lt;/code&gt;.</param>
 /// <param name="defaultHostName">Default hostname of the app.
 /// Read-only.</param>
 /// <param name="slotSwapStatus">Status of the last deployment slot
 /// swap operation.</param>
 /// <param name="httpsOnly">HttpsOnly: configures a web site to accept
 /// only https requests. Issues redirect for
 /// http requests</param>
 /// <param name="redundancyMode">Site redundancy mode. Possible values
 /// include: 'None', 'Manual', 'Failover', 'ActiveActive',
 /// 'GeoRedundant'</param>
 /// <param name="inProgressOperationId">Specifies an operation id if
 /// this site has a pending operation.</param>
 /// <param name="storageAccountRequired">Checks if Customer provided
 /// storage account is required</param>
 /// <param name="keyVaultReferenceIdentity">Identity to use for Key
 /// Vault Reference authentication.</param>
 /// <param name="virtualNetworkSubnetId">Azure Resource Manager ID of
 /// the Virtual network and subnet to be joined by Regional VNET
 /// Integration.
 /// This must be of the form
 /// /subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}</param>
 public Site(string location, string id = default(string), string name = default(string), string kind = default(string), string type = default(string), IDictionary <string, string> tags = default(IDictionary <string, string>), string state = default(string), IList <string> hostNames = default(IList <string>), string repositorySiteName = default(string), UsageState?usageState = default(UsageState?), bool?enabled = default(bool?), IList <string> enabledHostNames = default(IList <string>), SiteAvailabilityState?availabilityState = default(SiteAvailabilityState?), IList <HostNameSslState> hostNameSslStates = default(IList <HostNameSslState>), string serverFarmId = default(string), bool?reserved = default(bool?), bool?isXenon = default(bool?), bool?hyperV = default(bool?), System.DateTime?lastModifiedTimeUtc = default(System.DateTime?), SiteConfig siteConfig = default(SiteConfig), IList <string> trafficManagerHostNames = default(IList <string>), bool?scmSiteAlsoStopped = default(bool?), string targetSwapSlot = default(string), HostingEnvironmentProfile hostingEnvironmentProfile = default(HostingEnvironmentProfile), bool?clientAffinityEnabled = default(bool?), bool?clientCertEnabled = default(bool?), ClientCertMode?clientCertMode = default(ClientCertMode?), string clientCertExclusionPaths = default(string), bool?hostNamesDisabled = default(bool?), string customDomainVerificationId = default(string), string outboundIpAddresses = default(string), string possibleOutboundIpAddresses = default(string), int?containerSize = default(int?), int?dailyMemoryTimeQuota = default(int?), System.DateTime?suspendedTill = default(System.DateTime?), int?maxNumberOfWorkers = default(int?), CloningInfo cloningInfo = default(CloningInfo), string resourceGroup = default(string), bool?isDefaultContainer = default(bool?), string defaultHostName = default(string), SlotSwapStatus slotSwapStatus = default(SlotSwapStatus), bool?httpsOnly = default(bool?), RedundancyMode?redundancyMode = default(RedundancyMode?), System.Guid?inProgressOperationId = default(System.Guid?), bool?storageAccountRequired = default(bool?), string keyVaultReferenceIdentity = default(string), string virtualNetworkSubnetId = default(string), ManagedServiceIdentity identity = default(ManagedServiceIdentity), ExtendedLocation extendedLocation = default(ExtendedLocation))
     : base(location, id, name, kind, type, tags)
 {
     State                       = state;
     HostNames                   = hostNames;
     RepositorySiteName          = repositorySiteName;
     UsageState                  = usageState;
     Enabled                     = enabled;
     EnabledHostNames            = enabledHostNames;
     AvailabilityState           = availabilityState;
     HostNameSslStates           = hostNameSslStates;
     ServerFarmId                = serverFarmId;
     Reserved                    = reserved;
     IsXenon                     = isXenon;
     HyperV                      = hyperV;
     LastModifiedTimeUtc         = lastModifiedTimeUtc;
     SiteConfig                  = siteConfig;
     TrafficManagerHostNames     = trafficManagerHostNames;
     ScmSiteAlsoStopped          = scmSiteAlsoStopped;
     TargetSwapSlot              = targetSwapSlot;
     HostingEnvironmentProfile   = hostingEnvironmentProfile;
     ClientAffinityEnabled       = clientAffinityEnabled;
     ClientCertEnabled           = clientCertEnabled;
     ClientCertMode              = clientCertMode;
     ClientCertExclusionPaths    = clientCertExclusionPaths;
     HostNamesDisabled           = hostNamesDisabled;
     CustomDomainVerificationId  = customDomainVerificationId;
     OutboundIpAddresses         = outboundIpAddresses;
     PossibleOutboundIpAddresses = possibleOutboundIpAddresses;
     ContainerSize               = containerSize;
     DailyMemoryTimeQuota        = dailyMemoryTimeQuota;
     SuspendedTill               = suspendedTill;
     MaxNumberOfWorkers          = maxNumberOfWorkers;
     CloningInfo                 = cloningInfo;
     ResourceGroup               = resourceGroup;
     IsDefaultContainer          = isDefaultContainer;
     DefaultHostName             = defaultHostName;
     SlotSwapStatus              = slotSwapStatus;
     HttpsOnly                   = httpsOnly;
     RedundancyMode              = redundancyMode;
     InProgressOperationId       = inProgressOperationId;
     StorageAccountRequired      = storageAccountRequired;
     KeyVaultReferenceIdentity   = keyVaultReferenceIdentity;
     VirtualNetworkSubnetId      = virtualNetworkSubnetId;
     Identity                    = identity;
     ExtendedLocation            = extendedLocation;
     CustomInit();
 }
Example #6
0
 /// <summary>
 /// Initializes a new instance of the SitePatchResource class.
 /// </summary>
 /// <param name="id">Resource Id.</param>
 /// <param name="name">Resource Name.</param>
 /// <param name="kind">Kind of resource.</param>
 /// <param name="type">Resource type.</param>
 /// <param name="state">Current state of the app.</param>
 /// <param name="hostNames">Hostnames associated with the app.</param>
 /// <param name="repositorySiteName">Name of the repository
 /// site.</param>
 /// <param name="usageState">State indicating whether the app has
 /// exceeded its quota usage. Read-only. Possible values include:
 /// 'Normal', 'Exceeded'</param>
 /// <param name="enabled">&lt;code&gt;true&lt;/code&gt; if the app is
 /// enabled; otherwise, &lt;code&gt;false&lt;/code&gt;. Setting this
 /// value to false disables the app (takes the app offline).</param>
 /// <param name="enabledHostNames">Enabled hostnames for the
 /// app.Hostnames need to be assigned (see HostNames) AND enabled.
 /// Otherwise,
 /// the app is not served on those hostnames.</param>
 /// <param name="availabilityState">Management information availability
 /// state for the app. Possible values include: 'Normal', 'Limited',
 /// 'DisasterRecoveryMode'</param>
 /// <param name="hostNameSslStates">Hostname SSL states are used to
 /// manage the SSL bindings for app's hostnames.</param>
 /// <param name="serverFarmId">Resource ID of the associated App
 /// Service plan, formatted as:
 /// "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}".</param>
 /// <param name="reserved">&lt;code&gt;true&lt;/code&gt; if reserved;
 /// otherwise, &lt;code&gt;false&lt;/code&gt;.</param>
 /// <param name="isXenon">Obsolete: Hyper-V sandbox.</param>
 /// <param name="hyperV">Hyper-V sandbox.</param>
 /// <param name="lastModifiedTimeUtc">Last time the app was modified,
 /// in UTC. Read-only.</param>
 /// <param name="siteConfig">Configuration of the app.</param>
 /// <param name="trafficManagerHostNames">Azure Traffic Manager
 /// hostnames associated with the app. Read-only.</param>
 /// <param name="scmSiteAlsoStopped">&lt;code&gt;true&lt;/code&gt; to
 /// stop SCM (KUDU) site when the app is stopped; otherwise,
 /// &lt;code&gt;false&lt;/code&gt;. The default is
 /// &lt;code&gt;false&lt;/code&gt;.</param>
 /// <param name="targetSwapSlot">Specifies which deployment slot this
 /// app will swap into. Read-only.</param>
 /// <param name="hostingEnvironmentProfile">App Service Environment to
 /// use for the app.</param>
 /// <param name="clientAffinityEnabled">&lt;code&gt;true&lt;/code&gt;
 /// to enable client affinity; &lt;code&gt;false&lt;/code&gt; to stop
 /// sending session affinity cookies, which route client requests in
 /// the same session to the same instance. Default is
 /// &lt;code&gt;true&lt;/code&gt;.</param>
 /// <param name="clientCertEnabled">&lt;code&gt;true&lt;/code&gt; to
 /// enable client certificate authentication (TLS mutual
 /// authentication); otherwise, &lt;code&gt;false&lt;/code&gt;. Default
 /// is &lt;code&gt;false&lt;/code&gt;.</param>
 /// <param name="clientCertExclusionPaths">client certificate
 /// authentication comma-separated exclusion paths</param>
 /// <param name="hostNamesDisabled">&lt;code&gt;true&lt;/code&gt; to
 /// disable the public hostnames of the app; otherwise,
 /// &lt;code&gt;false&lt;/code&gt;.
 /// If &lt;code&gt;true&lt;/code&gt;, the app is only accessible via
 /// API management process.</param>
 /// <param name="outboundIpAddresses">List of IP addresses that the app
 /// uses for outbound connections (e.g. database access). Includes VIPs
 /// from tenants that site can be hosted with current settings.
 /// Read-only.</param>
 /// <param name="possibleOutboundIpAddresses">List of IP addresses that
 /// the app uses for outbound connections (e.g. database access).
 /// Includes VIPs from all tenants. Read-only.</param>
 /// <param name="containerSize">Size of the function container.</param>
 /// <param name="dailyMemoryTimeQuota">Maximum allowed daily
 /// memory-time quota (applicable on dynamic apps only).</param>
 /// <param name="suspendedTill">App suspended till in case memory-time
 /// quota is exceeded.</param>
 /// <param name="maxNumberOfWorkers">Maximum number of workers.
 /// This only applies to Functions container.</param>
 /// <param name="cloningInfo">If specified during app creation, the app
 /// is cloned from a source app.</param>
 /// <param name="resourceGroup">Name of the resource group the app
 /// belongs to. Read-only.</param>
 /// <param name="isDefaultContainer">&lt;code&gt;true&lt;/code&gt; if
 /// the app is a default container; otherwise,
 /// &lt;code&gt;false&lt;/code&gt;.</param>
 /// <param name="defaultHostName">Default hostname of the app.
 /// Read-only.</param>
 /// <param name="slotSwapStatus">Status of the last deployment slot
 /// swap operation.</param>
 /// <param name="httpsOnly">HttpsOnly: configures a web site to accept
 /// only https requests. Issues redirect for
 /// http requests</param>
 /// <param name="redundancyMode">Site redundancy mode. Possible values
 /// include: 'None', 'Manual', 'Failover', 'ActiveActive',
 /// 'GeoRedundant'</param>
 /// <param name="inProgressOperationId">Specifies an operation id if
 /// this site has a pending operation.</param>
 /// <param name="geoDistributions">GeoDistributions for this
 /// site</param>
 public SitePatchResource(string id = default(string), string name = default(string), string kind = default(string), string type = default(string), string state = default(string), IList <string> hostNames = default(IList <string>), string repositorySiteName = default(string), UsageState?usageState = default(UsageState?), bool?enabled = default(bool?), IList <string> enabledHostNames = default(IList <string>), SiteAvailabilityState?availabilityState = default(SiteAvailabilityState?), IList <HostNameSslState> hostNameSslStates = default(IList <HostNameSslState>), string serverFarmId = default(string), bool?reserved = default(bool?), bool?isXenon = default(bool?), bool?hyperV = default(bool?), System.DateTime?lastModifiedTimeUtc = default(System.DateTime?), SiteConfig siteConfig = default(SiteConfig), IList <string> trafficManagerHostNames = default(IList <string>), bool?scmSiteAlsoStopped = default(bool?), string targetSwapSlot = default(string), HostingEnvironmentProfile hostingEnvironmentProfile = default(HostingEnvironmentProfile), bool?clientAffinityEnabled = default(bool?), bool?clientCertEnabled = default(bool?), string clientCertExclusionPaths = default(string), bool?hostNamesDisabled = default(bool?), string outboundIpAddresses = default(string), string possibleOutboundIpAddresses = default(string), int?containerSize = default(int?), int?dailyMemoryTimeQuota = default(int?), System.DateTime?suspendedTill = default(System.DateTime?), int?maxNumberOfWorkers = default(int?), CloningInfo cloningInfo = default(CloningInfo), string resourceGroup = default(string), bool?isDefaultContainer = default(bool?), string defaultHostName = default(string), SlotSwapStatus slotSwapStatus = default(SlotSwapStatus), bool?httpsOnly = default(bool?), RedundancyMode?redundancyMode = default(RedundancyMode?), System.Guid?inProgressOperationId = default(System.Guid?), IList <GeoDistribution> geoDistributions = default(IList <GeoDistribution>))
     : base(id, name, kind, type)
 {
     State                       = state;
     HostNames                   = hostNames;
     RepositorySiteName          = repositorySiteName;
     UsageState                  = usageState;
     Enabled                     = enabled;
     EnabledHostNames            = enabledHostNames;
     AvailabilityState           = availabilityState;
     HostNameSslStates           = hostNameSslStates;
     ServerFarmId                = serverFarmId;
     Reserved                    = reserved;
     IsXenon                     = isXenon;
     HyperV                      = hyperV;
     LastModifiedTimeUtc         = lastModifiedTimeUtc;
     SiteConfig                  = siteConfig;
     TrafficManagerHostNames     = trafficManagerHostNames;
     ScmSiteAlsoStopped          = scmSiteAlsoStopped;
     TargetSwapSlot              = targetSwapSlot;
     HostingEnvironmentProfile   = hostingEnvironmentProfile;
     ClientAffinityEnabled       = clientAffinityEnabled;
     ClientCertEnabled           = clientCertEnabled;
     ClientCertExclusionPaths    = clientCertExclusionPaths;
     HostNamesDisabled           = hostNamesDisabled;
     OutboundIpAddresses         = outboundIpAddresses;
     PossibleOutboundIpAddresses = possibleOutboundIpAddresses;
     ContainerSize               = containerSize;
     DailyMemoryTimeQuota        = dailyMemoryTimeQuota;
     SuspendedTill               = suspendedTill;
     MaxNumberOfWorkers          = maxNumberOfWorkers;
     CloningInfo                 = cloningInfo;
     ResourceGroup               = resourceGroup;
     IsDefaultContainer          = isDefaultContainer;
     DefaultHostName             = defaultHostName;
     SlotSwapStatus              = slotSwapStatus;
     HttpsOnly                   = httpsOnly;
     RedundancyMode              = redundancyMode;
     InProgressOperationId       = inProgressOperationId;
     GeoDistributions            = geoDistributions;
     CustomInit();
 }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            CloningInfo cloningInfo = null;
            if (SourceWebApp != null)
            {
                cloningInfo = new CloningInfo
                {
                    SourceWebAppId = SourceWebApp.Id,
                    CloneCustomHostNames = !IgnoreCustomHostNames.IsPresent,
                    CloneSourceControl = !IgnoreSourceControl.IsPresent,
                    ConfigureLoadBalancing = false,
                    AppSettingsOverrides = AppSettingsOverrides == null ? null : AppSettingsOverrides.Cast<DictionaryEntry>().ToDictionary(kvp => kvp.Key.ToString(), kvp => kvp.Value.ToString(), StringComparer.Ordinal)
                };
            }

            var webApp = WebsitesClient.GetWebApp(ResourceGroupName, Name, null);

            WriteObject(WebsitesClient.CreateWebApp(ResourceGroupName, Name, Slot, webApp.Location, AppServicePlan, cloningInfo));
        }
        public override void ExecuteCmdlet()
        {
            CloningInfo cloningInfo = null;
            if (SourceWebApp != null)
            {
                cloningInfo = new CloningInfo
                {
                    SourceWebAppId = SourceWebApp.Id,
                    CloneCustomHostNames = !IgnoreCustomHostNames.IsPresent,
                    CloneSourceControl = !IgnoreSourceControl.IsPresent,
                    TrafficManagerProfileId = TrafficManagerProfileId,
                    TrafficManagerProfileName = TrafficManagerProfileName,
                    ConfigureLoadBalancing = !string.IsNullOrEmpty(TrafficManagerProfileId) || !string.IsNullOrEmpty(TrafficManagerProfileName),
                    AppSettingsOverrides = AppSettingsOverrides == null ? null: AppSettingsOverrides.Cast<DictionaryEntry>().ToDictionary(kvp => kvp.Key.ToString(), kvp => kvp.Value.ToString(), StringComparer.Ordinal)
                };
            }

            var cloneWebAppSlots = false;
            string[] slotNames = null;
            string srcResourceGroupName = null;
            string srcwebAppName = null;
            string srcSlotName = null;
            if (IncludeSourceWebAppSlots.IsPresent)
            {
                CmdletHelpers.TryParseWebAppMetadataFromResourceId(SourceWebApp.Id, out srcResourceGroupName,
                    out srcwebAppName, out srcSlotName);
                var slots = WebsitesClient.ListWebApps(srcResourceGroupName, srcwebAppName);
                if (slots != null && slots.Any())
                {
                    slotNames = slots.Select(s => s.Name.Replace(srcwebAppName + "/", string.Empty)).ToArray();
                    cloneWebAppSlots = true;
                }
            }

            if (cloneWebAppSlots)
            {
                WriteVerboseWithTimestamp("Cloning source web app '{0}' to destination web app {1}", srcwebAppName, Name);
            }

            WriteObject(WebsitesClient.CreateWebApp(ResourceGroupName, Name, null, Location, AppServicePlan, cloningInfo, AseName, AseResourceGroupName));

            if (cloneWebAppSlots)
            {
                WriteVerboseWithTimestamp("Cloning all deployment slots of source web app '{0}' to destination web app {1}", srcwebAppName, Name);
                CloneSlots(slotNames);
            }
        }
        protected override void ProcessRecord()
        {
            CloningInfo cloningInfo = null;
            if (SourceWebApp != null)
            {
                cloningInfo = new CloningInfo
                {
                    SourceWebAppId = SourceWebApp.Id,
                    CloneCustomHostNames = !IgnoreCustomHostNames.IsPresent,
                    CloneSourceControl = !IgnoreSourceControl.IsPresent,
                    TrafficManagerProfileId = TrafficManagerProfileId,
                    TrafficManagerProfileName = TrafficManagerProfileName,
                    ConfigureLoadBalancing = !string.IsNullOrEmpty(TrafficManagerProfileId) || !string.IsNullOrEmpty(TrafficManagerProfileName),
                    AppSettingsOverrides = AppSettingsOverrides == null ? null: AppSettingsOverrides.Cast<DictionaryEntry>().ToDictionary(kvp => kvp.Key.ToString(), kvp => kvp.Value.ToString(), StringComparer.Ordinal)
                };
            }

            WriteObject(WebsitesClient.CreateWebApp(ResourceGroupName, Name, null, Location, AppServicePlan, cloningInfo));
        }