# Webhooks Scripts

> Parameters and usage for the Publish-Webhooks.ps1 script for deploying or updating the Webhooks Service

## Publish to Webhooks

The following table describes all the parameters that you can use with the `Publish-Webhooks.ps1` script.

 <colgroup>
  <col/>
  <col/>
 </colgroup>
 
  
     Parameter  
     Description  
  
 
 
  
    <code>-action</code> 
     Indicate the scenario to be run, the available options are: 
      
         <code>Deploy</code> - specifies it is a clean installation; 
         <code>Update</code> - specifies you are updating your Webhooks Service instance. 
      

  
  
    <code>-azureAccountApplicationId</code> 
     The Azure service principal ID. Note: The indicated service principal must be assigned the Contributor role to the app service at the subscription scope. 
  
  
    <code>-azureAccountPassword</code> 
     The Azure token password for the service principal ID.  
  
  
    <code>-azureSubscriptionId</code> 
     The Azure subscription ID for the respective App Service.  
  
  
    <code>-azureAccountTenantId</code> 
     The Azure tenant ID.  
  
  
    <code>-appServiceName</code> 
     The Webhook Azure App Service name. Note: This should be different from your Orchestrator App Service name. 
  
  
    <code>-resourceGroupName</code> 
     The name of the Azure Resource Group that contains the Webhook App Service.  
  
  
    <code>-package</code> 
    Indicate the full path or relative path of the <code>UiPath.WebhookService.zip</code> archive. 
  
  
    <code>-stopApplicationBeforePublish</code> 
     When present, stops the application prior to beginning the deployment and then restarts it after the deployment is complete.  
  
  
    <code>-noAzureAuthentication</code> 
    Optional. Allows you to publish to the Azure App Service by relying on your own user identity, without having to create a service principal.

If this parameter is used, the <code>UseServicePrincipal</code> parameter set (which includes items such as the Azure application ID, password, subscription ID, and tenant ID) are no longer necessary. 
  
  
    <code>-azureUSGovernmentLogin</code> 
    Optional. This parameter is only used for US Government deployments. 
  
 

The `Publish-Webhooks.ps1` script is used for the initial deployment or update of Webhooks. The script assumes that the web app already has the `DefaultConnection` database connection string configured.

```
.\Publish-Webhooks.ps1 `
-action deploy `
-package ".\UiPath.WebhookService.Web.zip" `
-azureAccountApplicationId "<AzureApplicationID>" `
-azureAccountPassword "<AzureAccountPassword>" `
-azureSubscriptionId "<SubscriptionID>" `
-azureAccountTenantId "<TenantID>" `
-resourceGroupName "<AzureResourceGroupYouPickedInStep1>" `
-appServiceName "<UiPathWebhookService>"
```

:::important
Following an initial deployment, you must also execute the `MigrateTo-Webhooks.ps1` script.
:::

## Migrate to Webhooks

The following table describes all the parameters that you can use with the `MigrateTo-Webhooks.ps1` script.

 <colgroup>
  <col/>
  <col/>
 </colgroup>
 
  
     Parameters  
     Description  
  
 
 
  
    <code>-cliPackage</code> 
    Indicate the path to the <code>UiPath.WebhookService.Migrate.Cli.zip</code> archive. 
  
  
    <code>-azureDetails</code> 
     A hash table with the following values: 
      
         <code>azureAccountApplicationId</code> - The Azure service principal ID.. 
         <code>azureAccountPassword</code> - The Azure token password for the service principal ID. 
         <code>azureSubscriptionId</code> - The Azure subscription ID for the respective App Service. 
         <code>azureAccountTenantId</code> - The Azure tenant ID. 
      

  
  
    <code>-orchDetails</code> 
     A hash table with the following values: 
      
         <code>resourceGroupName</code> - The name of the Azure Resource Group that contains the Orchestrator App Service. 
         <code>appServiceName</code> - The Orchestrator App Service name. 
         <code>targetSlot</code> - The Target App Service Slot set by Azure. 
      

  
  
    <code>-webhooksDetails</code> 
     A hash table with the following values: 
      
         <code>resourceGroupName</code> - The name of the Azure Resource Group that contains the Webhook App Service. 
         <code>appServiceName</code> - The Webhook App Service name. 
         <code>targetSlot</code> - The Target App Service Slot set by Azure. 
      

  
  
    <code>-noAzureAuthentication</code> 
    Optional. Allows you to publish to the Azure App Service by relying on your own user identity, without having to create a service principal.

If this parameter is used, the <code>UseServicePrincipal</code> parameter set (which includes items such as the Azure application ID, password, subscription ID, and tenant ID) are no longer necessary. 
  
 

This `MigrateTo-Webhooks.ps1` script is used to migrate data from an existing Orchestrator instance to a new Webhook App Service and set the configurations for both. The script assumes that Orchestrator and Webhooks are already published.

```
.\MigrateTo-Webhooks.ps1 `
    -cliPackage "UiPath.WebhookService.Migrator.Cli.zip"`
    -azureDetails @{azureSubscriptionId = "<subscription_id>"; azureAccountTenantId = "<azure_tenant_id>"; azureAccountApplicationId = "<azure_application_id>"; azureAccountPassword = "<azure_account_password>" } `
    -orchDetails @{ resourceGroupName = "<resourcegroup_name>"; appServiceName = "<appservice_name>";  targetSlot = "Production" } `
    -webhookDetails @{ resourceGroupName = "<resourcegroup_name>"; appServiceName = "<appservice_name>"; targetSlot = "Production" }
```
