Skip to content

Create and manage stores

This article discusses how you can create and manage stores using the new cmdlets in the Zervicepoint Powershell module.

Introduction

Version 1.20.XXXX of Zervicepoint introduces a few new cmdlets designed to create, update and delete stores. This article will provide you with some practical examples.

The new cmdlets covered in this article are:

  • Get-ZPStore
  • New-ZPStore
  • Set-ZPStore
  • Remove-ZPStore
  • New-ZPCertificate
  • New-ZPTrustedIssuer

Please note that in order to retrieve, create, update and remove stores other than the store you're logged in to, you must be a member of the CentralAdministrator role in addition to theĀ ApiStoreAdministrator role required for API access.

Retrieving information about a store

To retrieve information about a store, use the Get-ZPStore cmdlet. You can retrieve a store based on its ID, UniqueID, Name, DisplayName or RouteName. You can also list all the stores in the Zervicepoint instance.

Example: Retrieving stores using Get-ZPStore

# Get store by ID
Get-ZPStore -Id 1

# Get store by UniqueId
Get-ZPStore -UniqueId d74d3d54-2438-4078-a26e-c14b6324d931

# Get store by Name
Get-ZPStore -Name Store

# Get all stores (or the current store if you are not a central aministrator)
Get-ZPStore

Creating a new store from scratch

To create a new store from scratch you can either create a store object using the New-Object cmdlet, populate its members and run the New-ZPStore cmdlet with the -Object parameter, or you can run New-ZPStore passing the store properties as separate parameters. Below are two examples demonstrating the two approaches.

Example: Creating a new store using the -Object parameter

# Get an empty Store object
$store = New-Object Zipper.ZervicePoint.WebApi.PowerShell.Models.Store

# Set general properties
$store.Name = $store.DisplayName = $store.RouteName = "Demo1"
$store.Languages = @("en-US", "sv-SE")
$store.DefaultLanguage = "en-US"
$store.DefaultCulture = "en-US"
$store.DefaultTimeZone = "W. Europe Standard Time"
$store.UseNewUI = $true

# Set authentication properties
$store.IdentityProviderType = [Zipper.ZervicePoint.WebApi.PowerShell.Models.IdentityProviderType]::ADFS
$store.Issuer = "https://auth.company.com/adfs/ls/"
$store.FederationMetadataEndpoint = "https://auth.company.com/FederationMetadata/2007-06/FederationMetadata.xml"
$store.TrustedIssuers.Add((New-ZPTrustedIssuer -Type Login -Name auth.company.com -Thumbprint 56A9436980D7085EC8F25486DA39F3C38CC0F641))
$store.TrustedIssuers.Add((New-ZPTrustedIssuer -Type Provisioning -Name auth.company.com -Thumbprint 56A9436980D7085EC8F25486DA39F3C38CC0F641))

# Set outgoing email properties
$store.SMTPServer = "smtpserver.company.com"
$store.SMTPPort = 25
$store.SMTPEnableSSL = $true
$store.SMTPFromAddress = "noreply@conmpany.com"

# Set store administrators
$store.StoreAdministrators = @("administrator@company.com")

# Set on-premises properties
$store.ClientWebServiceUrl = "https://zervicepoint.company.com:8443/ProviderService.svc/CallProvider"
$store.ProvisioningAccount = "administrator"
# Create a new certificate
$certificate = New-ZPCertificate -CommonName demo1.zervicepoint.company.com -PassThru
# Set thumbprints for datasigning and tokensigning
$store.DataSigningCertificateThumbprint = $certificate.Thumbprint
$store.TokenSigningCertificateThumbprint = $certificate.Thumbprint

# Create the store
New-ZPStore -Object $store

Example: Creating a store using separate parameters

# Create trusted issuer objects for login and provisioning
$loginTrustedIssuer = New-ZPTrustedIssuer -Type Login -Name auth.company.com -Thumbprint 56A9436980D7085EC8F25486DA39F3C38CC0F641
$provisioningTrustedIssuer = New-ZPTrustedIssuer -Type Provisioning -Name auth.company.com -Thumbprint 56A9436980D7085EC8F25486DA39F3C38CC0F641

# Create a certificate for datasigning and tokensigning
$certificate = New-ZPCertificate -CommonName demo2.zervicepoint.company.com -PassThru

# Create the store
New-ZPStore -Name "Demo2" -DisplayName "Demo2" -RouteName "Demo2" -Language @("en-US","sv-SE") -DefaultLanguage "en-US" -DefaultCulture "en-US" -DefaultTimeZone "W. Europe Standard Time" -UseNewUI $true -IdentityProviderType ADFS -Issuer "https://auth.company.com/adfs/ls/" -FederationMetadataEndpoint "https://auth.company.com/FederationMetadata/2007-06/FederationMetadata.xml" -TrustedIssuer @($loginTrustedIssuer,$provisioningTrustedIssuer) -SMTPServer "smtpserver.company.com" -SMTPPort 25 -SMTPEnableSSL $true -SMTPFromAddress "noreply@conmpany.com" -StoreAdministrator @("administrator@company.com") -ClientWebServiceUrl "https://zervicepoint.company.com:8443/ProviderService.svc/CallProvider" -ProvisioningAccount "administrator" -DataSigningCertificateThumbprint $certificate.Thumbprint -TokenSigningCertificateThumbprint $certificate.Thumbprint

Creating a new store based on an existing store

You can use the Get-ZPStore cmdlet to get an existing store object, modify any properties you want, and then pass the store object to the New-ZPStore cmdlet. Here's an example:

Example: Creating a store based on an existing store

# Get an existing store
$store = Get-ZPStore -Name Store

# Modify some properties (Name, RouteName and AddressMappings mast be unique)
$store.Name = "Demo3"
$store.DisplayName = $store.Name
$store.RouteName = $store.Name
$store.AddressMappings.Clear()
$store.StoreAdministrators = @("demo3administrator@company.com")
$certificate = New-ZPCertificate -CommonName demo3.zervicepoint.company.com -PassThru
$store.DataSigningCertificateThumbprint = $certificate.Thumbprint
$store.TokenSigningCertificateThumbprint = $certificate.Thumbprint

# Create the new store
$store | New-ZPStore

Creating a new store and cloning the content of an existing store

When creating a new store using the New-ZPStore cmdlet, you can use the -ContentStore parameter to clone the content (services, shared processes, pages, tags etc) of an existing store. Here's an example:

Example: Creating a store and cloning content of an existing store

# Get an existing store
$store = Get-ZPStore -Name Store

# Set new name, displayname and routename, and clear the address mappings
$store.Name = "Demo4"
$store.DisplayName = $store.Name
$store.RouteName = $store.Name
$store.AddressMappings.Clear()

# Create the new store
$store | New-ZPStore -ContentStore Store

Updating an existing store

To update an existing store, you start by retrieving the store using Get-ZPStore, then changing the desired properties of the store object, and finally passing it to Set-ZPStore. Here's an example:

Example: Generating a new certificate and updating the store

# Get the store
$store = Get-ZPStore -Name Demo1

# Generate new certificate and update the thumbprint properties
$certificate = New-ZPCertificate -CommonName demo2.zervicepoint.company.com -PassThru
$store.DataSigningCertificateThumbprint = $certificate.Thumbprint
$store.TokenSigningCertificateThumbprint = $certificate.Thumbprint

# Commit changes
Set-ZPStore -Object $store

Deleting a store

You can delete an existing store using Remove-ZPStore by either passing the store object (using the pipeline or the -Object parameter), or by passing the ID, UniqueId, Name, DisplayName or RouteName. Below are a few examples:

Example: Deleting a store

# Deleting a store by passing the store object
Get-ZPStore -Name Demo1 | Remove-ZPStore

# Deleting a store by ID
Remove-ZPStore -Id 3

# Deleting a store by Name
Remove-ZPStore -Name Demo3