I want to set up a web application that can be accessed from three kind of authentication on the default zone:
- anonymous
- Windows
- FBA (over a custom provider)
and two other zones without the windows authentication.
I have this script :
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction 0
$defaultZoneUrl = "http://adm.local.mydomain.int"
$intranetZoneUrl = "https://local.mydomain.int"
$internetZoneUrl = "http://a.local.mydomain.int"
$winAp = new-SPAuthenticationProvider -UseWindowsIntegratedAuthentication -DisableKerberos
$anoAp = new-SPAuthenticationProvider -AllowAnonymous
$fbaAp = new-SPAuthenticationProvider -ASPNETMembershipProvider "CustMembershipProvider" -ASPNETRoleProviderName "CustRoleProvider"
$webApp = new-SPWebApplication -ApplicationPool "SharePoint - 80" `
-AuthenticationProvider $winAp, $anoAp, $fbaAp `
-DatabaseName "Wss_Content_Dev" `
-HostHeader "adm.local.mydomain.int" `
-Name "Dev web application" `
-Port 80 `
-SignInRedirectURL "/_layouts/cust/login.aspx"
$intranetWebApp = new-SPWebApplicationExtension -AuthenticationProvider $anoAp, $fbaAp `
-Identity $webApp `
-Zone "Intranet" `
-HostHeader "local.mydomain.int" `
-Port 443 `
-SecureSocketsLayer `
-SignInRedirectURL "/_layouts/cust/login.aspx"
$anoWebApp = new-SPWebApplicationExtension -AuthenticationProvider $anoAp, $fbaAp `
-Identity $webApp `
-Zone "Intranet" `
-HostHeader "a.local.mydomain.int" `
-Port 80 `
-SecureSocketsLayer `
-SignInRedirectURL "/_layouts/cust/login.aspx"
However, this breaks on the web application creation with the error :
New-SPWebApplication : Exception of type 'System.ArgumentException' was thrown.
Parameter name: provider
At E:\Scripts\SetupEnvironment\CreateWebAppAndZones.ps1:13 char:31
+ $webApp = new-SPWebApplication <<<< -AllowAnonymousAccess `
+ CategoryInfo : InvalidData: (Microsoft.Share...PWebApplication:SPCmdletNewSPWebApplication) [New-SPWebApplication], ArgumentException
+ FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletNewSPWebApplication
I also tried but setting explicitely the flag -AllowAnonymous
but the error remains.
When I go to the Central administration, my Web app is created, but is not claims enabled.
How can I correct my script to reach my goal ?