# Billing

1. Download the below installers and extract tools folder <https://cloudassertdownloads.blob.core.windows.net/usage/Billing2.1.7/WAP/2.1.7.17/CloudAssert.WAP.Billing.AgentService.Setup.msi> <https://cloudassertdownloads.blob.core.windows.net/usage/Billing2.1.7/WAP/2.1.7.17/CloudAssert.WAP.Billing.Extension.Admin.Setup.msi> <https://cloudassertdownloads.blob.core.windows.net/usage/Billing2.1.7/WAP/2.1.7.17/CloudAssert.WAP.Billing.Extension.Tenant.Setup.msi> <https://cloudassertdownloads.blob.core.windows.net/usage/Billing2.1.7/WAP/2.1.7.17/CloudAssert.WAP.Billing.Service.Setup.msi> <https://cloudassertdownloads.blob.core.windows.net/usage/Billing2.1.7/WAP/2.1.7.17/Tools.zip>
2. Save the below files in the same folder where we have the installers (downloaded in step #1) <https://cloudassertdownloads.blob.core.windows.net/usage/Initialize.ini> <https://cloudassertdownloads.blob.core.windows.net/usage/shttetup.bat>
3. Create database for Billing
4. Fill the below details in initialize.ini
   1. Database Server - Database server name
   2. CREATE\_DATABASE\_USERNAME - Billing DB user name
   3. CREATE\_DATABASE\_PASSWORD - Database Password
   4. DBSQLAUTH\_USERNAME - Billing DB user name
   5. DBSQLAUTH\_PASSWORD - Database Password &#x20;
   6. DBSQLAUTH\_PASSWORD\_CONFIRM - Database Password
   7. RUNTIME\_DATABASE\_NAME - Billing database name
   8. RUNTIME\_DATABASE\_USERNAME - Billing DB user name
   9. RUNTIME\_DATABASE\_PASSWORD - Database Password
   10. RUNTIME\_DB\_CONNECTION\_STRING - Database connection string; example: Data Source=DESKTOP-G274HJH\MSSQLSERVER01;Initial Catalog=Billing.MFA; User Id=hybradmin; password=admin (user must be SQL authentication)
   11. UANDB\_API\_URL - <http://localhost:30045>
   12. UANDB\_API\_USERNAME - Specify API username ex: admin.&#x20;
   13. UANDB\_API\_PASSWORD - Specify API password ex: BillingApiPassword\@123
   14. UANDB\_API\_PASSWORD\_CONFIRM - Confirm the password entered in above entry
       1. NOTE: Note down the last 3 values, these are required while configuring Billing API details in Hybr.
5. From Powershell, run setup.bat to install API service. Command is: `.\setup.bat install-api` **Note:** Make sure that you don’t have any white spaces in your file path
6. Update the database using billing tool.
   1. Navigate inside tool folder
   2. Execute the below command with Billing datab.\sase details using command prompt. Command:  `Billing.exe UpdateDatabase /ApiEndpoint:{String} /Username:{String} /Password:{String}`Note: API end point, user name and password needs to be same as the values given in initialize.ini
7. From Powershell, run setup.bat to install Agent service. Command is: `.\setup.bat install-agent`**Note:** Make sure that you don’t have any white spaces in your file path
8. Set the configuration ‘IsWapDeployment’ to false in API and AgentService configs. Paths:
   1. API – C:\inetpub\MgmtSvc-CloudAssertBilling\Web.Config
   2. Agent Service - C:\Program Files\CloudAssertBilling\CloudAssert.WAP.Billing.AgentService\CloudAssert.WAP.Billing.AgentService.exe.config
9. Verify `TrisulSubscriptionEventProcessor.Enabled` configuration in AgentService config and set it to `true` if it is not. Path: C:\Program Files\CloudAssertBilling\CloudAssert.WAP.Billing.AgentService\CloudAssert.WAP.Billing.AgentService.exe.config
10. Enable VConnect Usage Collector if required. Follow below steps to make sure that all configurations are done.
    1. Configure 'VConnectApi' settings in Usage and Billing database.&#x20;
    2. Set `VConnectUsageCollector.Enabled` setting to `true` in AgentService.exe.config file. Path: C:\Program Files\CloudAssertBilling\CloudAssert.WAP.Billing.AgentService\CloudAssert.WAP.Billing.AgentService.exe.config
11. **Billing - Service Notification Handler settings**
    1. Install Billing API & Agent service Hybr build (New build configuration allows us to take Hybr build)
    2. Set below app settings with appropriate values
    3. Add Hybr endpoint in etc/host file
    4. Start the Agent service
    5. Execute the below file commands with relevant inputs. On completion of that

{% file src="/files/-Lzpumv1vA4pXdZLBpM2" %}
Billing - Setup Event Notifications
{% endfile %}

| **Settings Name**                  | **Group**    | **Value**                           |
| ---------------------------------- | ------------ | ----------------------------------- |
| HybrApiEndpoint                    | HybrSettings | ex: <https://local.admin.hybr.com/> |
| HybrApiUsername                    | HybrSettings | ex: hybrapiuser                     |
| HybrApiPassword                    | HybrSettings | ex: pass\@word1                     |
| HybrServiceNotificationEventSource | HybrSettings | (trisulapi/azurestoragequeue)       |
| ServiceNotificationQueueSasUri     | HybrSettings | (Azure storage queue sas uri)       |

12\. Insert queue URL in Billing Database - Ignore this step if Cloud Assert Event handler is used

* Update shared access signature of Azure storage account queue in the below insert script and execute in Billing DB. **Note:** Azure storage account queue is one of the prerequisites.

`insert into [Billing].[dbo].[AppSettings]([Key], [Value], [Group], Version, IsEncrypted, LastUpdatedTime) Values('ServiceNotificationQueueSasUri', '{queueUrl}', 'HybrSettings', '1.0', 0, GETDATE())`

13\. License Activation

* Download and extract [VConnect.zip](https://cloudassertdownloads.blob.core.windows.net/vconnect-rtm/VConnect.zip)
* Navigate inside the extracted folder and execute the below command from command prompt
* Command: `VConnect.exe ActivateOnline licenseKey emailId` Note: Do not copy-paste the values directly into command prompt, paste it in notepad, remove spaces and add again before executing
* Once the command is executed successfully, .cal file will be generated in the same directory. Copy this file into C:\inetpub\MgmtSvc-CloudAssertBilling\bin

14\. **Post API and Agent Deployment Steps:**

* Once after the successful installation check agent version with Api version. Both should be same
* Billing agent service is up and running
* Agent config file check:
  * `Iswapdeployment` should be `false` in agent config file
  * `Trisuleventprocessor` should be `true`
  * As per the need, the `cspusageprocessor`, `csplicenselog` processor, VConnect processor AWS, Azure processors should be `true`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cloudassert.com/hybr/installation/deployment/billing-feature-deployment.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
