# Cost Management

### Backup the current version artifacts

* Stop the Cost Management agent service
* Take a back up of the Cost Management agent config file
  * File Path: C:\Program Files\CloudAssertCostManagement\CloudAssert.CostManagement.WindowsService\CloudAssert.CostManagement.WindowsService.exe.config
* Back up the Cost Management database

### Install the new build

* Uninstall the existing version of the Cost Management agent service
* Update the Cost Management Database using the Cost Management Tool. Make sure to update the connection string in tool web config before executing the update command

```
CloudAssert.CostManagement.Tool.exe UpdateDatabase
```

* Delete Staging tables - Execute the below SQL command against Cost Management Database

{% file src="<https://2861565768-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LoVCDjvSJF03p2a5huX%2F-MGo6yvJbydTL-w3xuYL%2F-MGo8vS4H84GsKk_IOj-%2FStagingTablesResetQuery.sql?alt=media&token=869031d7-15f6-4d66-883e-fbbc5d521d21>" %}
Staging Tables Reset Query
{% endfile %}

* Install the latest Cost Management agent service
* Stop the agent service
* Refer the previous version's agent config file and change the current one
* Start the agent service
