#iis powershell new webbinding
Explore tagged Tumblr posts
Text
Add Binding To IIS - PowerShell
Add Binding To IIS – PowerShell
Hi Guys, today we are going to disuses about how to add the binding to IIS using Powershell. In most case, during the deployments, the one of the painful activity is adding binding for new sites. So this below posts will help those members to one step towards of Automation.
The New-WebBinding cmdlet adds a new binding to an existing website.
#Assigining the URL which need to bind $_WebsiteUrl =…
View On WordPress
#add binding powershell#Add Binding To IIS With PowerShell#dotnet-helpers.com dotnethelpers.com thiyagu#iis powershell new webbinding#new-webbinding#new-webbinding powershell#powershell add iis site binding#powershell add ssl certificate to binding#powershell addsslcertificate#powershell iis binding ssl certificate#powershell iis bindings#powershell iis new item multiple bindings#powershell iis require ssl#powershell new-webbinding ssl certificate#set-webbinding
0 notes
Text
Host-Named Site Collections, Managed Paths and App Catalog with SharePoint 2016
In this article, we are going to set up a Host-Name Site Collection, Managed Paths and create a private App Catalog using SharePoint 2016 on-premise.
Introduction
Host-Named Site Collections enable us to assign a unique DNS name to Site Collections. So, it means that we can deploy many sites with unique DNS names in the same Web Application and it allows us to scale our environment to many customers. In other words, we can have something like http://sitea.domain.com and http://siteb.domain.com.
For the sake of our example, let's imagine that we need to set a development environment with multiple Collections, each for a different purpose, and a private App Catalog for our Add-Ins.
Here, we are not going to see how to configure the domain names in DNS and everything that is related to this part. So, of course, we have to check with the system administrator what could be done.
Creating the HNSC
Because Host-Named Site Collections can only be created with PowerShell and not from the Central Administration, we are going to build a PowerShell script that will create what we need: an Application Pool, a Web Application, a Root Site Collection and our Host-Named Site Collection.
First, we need the Application Pool:
New-SPServiceApplicationPool -Name $applicationPool -Account $managedAccount
We can now set our Web Application and create the required binding for IIS:
New-SPWebApplication -Name $webAppName -hostHeader -$webAppHostHeader -port $port -Url $webAppUrl -ApplicationPool $applicationPool -ApplicationPoolAccount (Get-SPManagedAccount $managedAccount) -AuthenticationProvider (New-SPAuthenticationProvider -UseWindowsIntegratedAuthentication) -DatabaseName $dataBase New-WebBinding -Name $webAppName -IPAddress "*" -Port $port -Protocol http
Then, we can create the Root Site Collection:
New-SPSite -Url $rootCollectionUrl -HostHeaderWebApplication (Get-SPWebApplication $webAppName) -Name $rootCollectionName -Description $rootCollectionDescription -OwnerAlias $ownerAlias
Now, let's set up our Host-Named Site Collection:
New-SPSite -Url $collectionUrl -HostHeaderWebApplication (Get-SPWebApplication $webAppName) -Name $collectionName -Description $collectionDescription -OwnerAlias $ownerAlias -language $language -Template $template
Finally, we can create a Collection using a Managed Path:
New-SPManagedPath -RelativeURL $managedPath -HostHeader -Explicit $url = $collectionUrl + "/" + $managedPath New-SPSite -Url $url -HostHeaderWebApplication $collectionUrl -Name $managedPathCollectionName -Description $managedPathCollectionDescription -OwnerAlias $ownerAlias -language $language -Template $template
Our PowerShell script could look something like this:
#******************# #***** PARAMS *****# #******************# Param( [string] $webAppName, [string] $webAppUrl, [string] $webAppHostHeader, [string] $applicationPool, [int] $port = 80, [string] $managedAccount, [string] $dataBase, [string] $rootCollectionUrl, [string] $rootCollectionName, [string] $rootCollectionDescription, [string] $collectionUrl, [string] $collectionName, [string] $collectionDescription, [string] $ownerAlias, [int] $language = 1033, [string] $template = "STS#0", [bool] $createAppPool = $true, [bool] $createWebApp = $true, [bool] $createRootCollection = $true, [bool] $createHostNameCollection = $true, [bool] $createManagedPathCollection = $true, [string] $managedPath, [string] $managedPathCollectionName, [string] $managedPathCollectionDescription ) #****************************************# #****************************************# #********************# #***** INCLUDES *****# #********************# Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #****************************************# #****************************************# #***********************************# #***** CREATE APPLICATION POOL *****# #***********************************# function CreateApplicationPool() { Write-Host "...creating application pool" New-SPServiceApplicationPool -Name $applicationPool -Account $managedAccount Write-Host "Application Pool created." -ForegroundColor Green Write-Host "" } #****************************************# #****************************************# #**********************************# #***** CREATE WEB APPLICATION *****# #**********************************# function CreateWebApplication() { Write-Host "...creating web application" New-SPWebApplication -Name $webAppName -hostHeader -$webAppHostHeader -port $port -Url $webAppUrl -ApplicationPool $applicationPool -ApplicationPoolAccount (Get-SPManagedAccount $managedAccount) -AuthenticationProvider (New-SPAuthenticationProvider -UseWindowsIntegratedAuthentication) -DatabaseName $dataBase New-WebBinding -Name $webAppName -IPAddress "*" -Port $port -Protocol http Write-Host "Web Application created." -ForegroundColor Green Write-Host "" } #****************************************# #****************************************# #**********************************# #***** CREATE ROOT COLLECTION *****# #**********************************# function CreateRootCollection() { Write-Host "...creating root collection" New-SPSite -Url $rootCollectionUrl -HostHeaderWebApplication (Get-SPWebApplication $webAppName) -Name $rootCollectionName -Description $rootCollectionDescription -OwnerAlias $ownerAlias Write-Host "Root Collection created." -ForegroundColor Green Write-Host "" } #****************************************# #****************************************# #****************************************# #***** CREATE HOST-NAMED COLLECTION *****# #****************************************# function CreateHostNamedCollection() { Write-Host "...creating host-named collection" New-SPSite -Url $collectionUrl -HostHeaderWebApplication (Get-SPWebApplication $webAppName) -Name $collectionName -Description $collectionDescription -OwnerAlias $ownerAlias -language $language -Template $template Write-Host "Host-Named Collection created." -ForegroundColor Green Write-Host "" } #****************************************# #****************************************# #******************************************# #***** CREATE MANAGED PATH COLLECTION *****# #******************************************# function CreateManagedPathCollection() { Write-Host "...creating managed path collection" New-SPManagedPath -RelativeURL $managedPath -HostHeader -Explicit Write-Host "Managed Path added." -ForegroundColor Green Write-Host "" $url = $collectionUrl + "/" + $managedPath New-SPSite -Url $url -HostHeaderWebApplication $collectionUrl -Name $managedPathCollectionName -Description $managedPathCollectionDescription -OwnerAlias $ownerAlias -language $language -Template $template Write-Host "Managed Path Collection created." -ForegroundColor Green Write-Host "" } #****************************************# #****************************************# #****************# #***** MAIN *****# #****************# function Main() { Write-Host "****************************************" Write-Host "***** CREATE HOST NAMED COLLECTION *****" Write-Host "****************************************" Write-Host " " Write-Host "***** START *****" -ForegroundColor Green Write-Host " " if ($createAppPool) { CreateApplicationPool } if ($createWebApp) { CreateWebApplication } if ($createRootCollection) { CreateRootCollection } if ($createHostNameCollection) { CreateHostNamedCollection } if ($createManagedPathCollection) { CreateManagedPathCollection } Write-Host " " Write-Host "***** END *****" -ForegroundColor Green Write-Host " " Read-Host -Prompt "Press ENTER to continue" exit } #****************************************# #****************************************# #******************# #***** SCRIPT *****# #******************# Main
We can now use our script like so:
.\create-host-named-collection.ps1 -webAppName "sp16dev1.com" -webAppUrl "http://sp16dev1.com" -webAppHostHeader "sp16dev1.com" -applicationPool "SharePoint - sp16dev1.com" -port 80 -managedAccount Domain\serviceAccount -dataBase WSS_Content_DevSP -rootCollectionUrl "http://rootsp16dev.com" -rootCollectionName "rootsp16dev" -rootCollectionDescription "Root collection" -collectionUrl "http://sp16dev.com" -collectionName "sp16dev" -collectionDescription "Main collection for development" -ownerAlias [email protected] -language 1033 -managedPath "addins-dev" -managedPathCollectionName "sp16dev-addins" -managedPathCollectionDescription "Collection for add-ins"
We could probably clean up a bit the number of arguments and add security checks to our script, but for now, it will be fine. If everything is alright, we should see our Wep Application and our Collections in the Central Administration.
Creating the App Catalog
We are now going to set up our App Catalog. First, we need to go in the Central Administration, then "System Settings", "Manage services in this farm". We have to click on "Enable Auto Provision" for "Microsoft SharePoint Foundation Subscription Settings Service".
Next, we have to create the "Subscription Settings" service application and proxy:
$SubscriptionSvcApp = New-SPSubscriptionSettingsServiceApplication -ApplicationPool 'SharePoint Web Services Default' -Name 'Subscriptions Settings Service Application' -DatabaseName 'Subscription' $SubscriptionSvcProxy = New-SPSubscriptionSettingsServiceApplicationProxy -ServiceApplication $SubscriptionSvcApp
We may also need to create a "App Management Service Application". It can be done under "Manage Service Applications". We have to click on "New" then "App Management Service". We can choose "SharePoint Web Services Default" for the "Application Pool".
We now have to head to the "Apps" page, click on the "Configure App URLs" link. In the "App domain" field, we have to enter the domain that we chose to host our apps and in the "App prefix" field, we need to specify which prefix we want to use. So, at the end of the day, we should have a URL for an app would be something like so "app-12345678ABCDEF.apps.sp16dev.com".
Using PowerShell, we now have to configure our app URLs for our tenant:
Set-SPAppDomain apps.sp16dev.com Set-SPAppSiteSubscriptionName -Name "app" -Confirm:$false
Now, let's head back to the Central Administration, then "Application Management", "Manage Web applications" and select our web application. On the ribbon, let's click on "Manage Features" and activate the "Apps that require accessible internet facing endpoints" feature.
We can now also enable sideloading on our dev site if needed:
Enable-SPFeature -identity "EnableAppSideLoading" -URL http://sp16dev.com/addins-dev
Finally, we can create our app catalog:
New-SPSite -Url "http://sp16dev.com/apps" -HostHeaderWebApplication "http://sp16dev.com" -Name "apps" -Description "App Catalog" -OwnerAlias [email protected] -language 1033 -Template "APPCATALOG#0"
If everything is alright, we can navigate to "http://sp16dev.com/apps" where we can upload our well-crafted Add-Ins and make them accessible in our different sites through the App Catalog.
Side note
We may have trouble with our catalog. Maybe this last one will tell us that there is nothing from our organization even though there are deployed apps. This post from Microsoft could be the answer to this problem.
Conclusion
Through this post, we saw what Host-Named Site Collections are and how we can set up our environment by using them. We also took a look at how can create a private App Catalog.
One last word
If you like this article, you can consider supporting and helping me on Patreon! It would be awesome! Otherwise, you can find my other posts on Medium and Tumblr. You will also know more about myself on my personal website. Until next time, happy headache!
1 note
·
View note