public override void ExecuteCmdlet() { if (ParameterSetName == ObjectParameterSet) { ResourceIdentifier identifier = new ResourceIdentifier(InputObject.Id); ResourceGroupName = identifier.ResourceGroupName; Name = InputObject.Name; } else if (ParameterSetName == ResourceIdParameterSet) { ResourceIdentifier identifier = new ResourceIdentifier(ResourceId); ResourceGroupName = identifier.ResourceGroupName; Name = InputObject.Name; } var existingFrontDoor = FrontDoorManagementClient.FrontDoors.ListByResourceGroup(ResourceGroupName) .FirstOrDefault(fd => fd.Name.ToLower() == Name.ToLower()); if (existingFrontDoor == null) { throw new PSArgumentException(string.Format( Resources.Error_FrontDoorNotFound, Name, ResourceGroupName)); } PSFrontDoor updateParameters; if (ParameterSetName == ObjectParameterSet) { updateParameters = InputObject; } else { updateParameters = existingFrontDoor.ToPSFrontDoor(); } // update each field based on optional input. if (this.IsParameterBound(c => c.RoutingRule)) { updateParameters.RoutingRules = RoutingRule.ToList(); } if (this.IsParameterBound(c => c.FrontendEndpoint)) { updateParameters.FrontendEndpoints = FrontendEndpoint.ToList(); } if (this.IsParameterBound(c => c.HealthProbeSetting)) { updateParameters.HealthProbeSettings = HealthProbeSetting.ToList(); } if (this.IsParameterBound(c => c.LoadBalancingSetting)) { updateParameters.LoadBalancingSettings = LoadBalancingSetting.ToList(); } if (this.IsParameterBound(c => c.BackendPool)) { updateParameters.BackendPools = BackendPool.ToList(); } if (this.IsParameterBound(c => c.Tag)) { updateParameters.Tags = Tag; } if (this.IsParameterBound(c => c.EnabledState)) { updateParameters.EnabledState = EnabledState; } if (this.IsParameterBound(c => c.DisableCertificateNameCheck)) { updateParameters.EnforceCertificateNameCheck = DisableCertificateNameCheck ? PSEnforceCertificateNameCheck.Disabled : PSEnforceCertificateNameCheck.Enabled; } updateParameters.ValidateFrontDoor(ResourceGroupName, this.DefaultContext.Subscription.Id); if (ShouldProcess(Resources.FrontDoorTarget, string.Format(Resources.FrontDoorChangeWarning, Name))) { try { var frontDoor = FrontDoorManagementClient.FrontDoors.CreateOrUpdate( ResourceGroupName, Name, updateParameters.ToSdkFrontDoor() ); WriteObject(frontDoor.ToPSFrontDoor()); } catch (Microsoft.Azure.Management.FrontDoor.Models.ErrorResponseException e) { throw new PSArgumentException(string.Format( Resources.Error_ErrorResponseFromServer, e.Response.Content)); } } }