> For the complete documentation index, see [llms.txt](https://docs.cloudassert.com/azure-stack-hub-multi-stamp-management/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cloudassert.com/azure-stack-hub-multi-stamp-management/2010.1/installation/prerequisites/create-sql-server-vm-in-tenant-subscription.md).

# Create SQL Server VM and necessary databases in a tenant subscription

If you have an **existing SQL server**, you can choose to use that SQL server instead of creating newly. Ensure SQL server authentication is enabled and you have **ANY valid SQL server authentication credential** available. The minimum recommended hardware configuration of the SQL server is 4 cores vCPU and 8 GB RAM.

**Step A** below allows to create a **new SQL Server VM** in Azure Stack for the given tenant subscription, SQL admin credential and 3 new databases necessary for VConnect RP installation.

&#x20;Proceed to **Step B** to ensure enabling necessary port and create appropriate new databases before proceeding to the installation. &#x20;

## HOST VM

On **AzS Development Kits**, sign in to the physical host.&#x20;

On **multi-node integrated systems**, the host must be a system that can access admin and tenant endpoints.

### Step A. Create all new SQL Server VM and necessary databases in a given tenant subscription

1. Go to the install folder that was unzipped and used in the previous installation step [AzureStack Certification Authority certificate](/azure-stack-hub-multi-stamp-management/2010.1/installation/prerequisites/get-azurestackcertificationauthority.cer.md) (c:\CloudAssert\VConnectMSM)
2. Open a new elevated (administrative) PowerShell  console and change to the above directory where the files have been extracted (c:\CloudAssert\VConnectMSM). Use a new window to avoid problems that might arise from incorrect PowerShell modules that are already loaded on the system.
3. Run SetupSqlServer.ps1 and specify the required parameters

```
.\SetupSqlServer.ps1 -DefaultProviderSubscriptionId "" -AdminArmEndpoint "" -ServiceAdminDirectoryTenantName "" -ServiceAdmin "" -ServiceTenantDirectoryTenantName "" -TenantSubscriptionId "" -ServiceTenant "" -VmLocalAdminUser "caadmin" -VconnectDatabaseName"" -SqlUser "" -SetupBillingAndDacm $True -BillingDatabaseName "CloudAssert.Billing" -DacmDatabaseName "CloudAssert.Dacm" -SqlPort 1433

Eg:
.\SetupSqlServer.ps1 -DefaultProviderSubscriptionId "26ec7c55-594d-432f-a728-2c072b942acd" -AdminArmEndpoint "https://adminmanagement.redmond.corp.contosotest.com" -ServiceAdminDirectoryTenantName "contosotest.onmicrosoft.com" -ServiceAdmin "cloudassert@contosotest.onmicrosoft.com" -ServiceTenantDirectoryTenantName "contosotest.onmicrosoft.com"-TenantSubscriptionId "80de4d0c-ae28-46eb-aab7-fc10aa92cebb" -ServiceTenant "cloudassert@contosotest.onmicrosoft.com" -VmLocalAdminUser "caadmin" -SqlDbName "CloudAssert.VConnect" -SqlUser "cadbadmin" -SetupBillingAndDacm $True -BillingDatabaseName "CloudAssert.Billing" -DacmDatabaseName "CloudAssert.Dacm" -SqlPort 1433
```

| Parameter Name                                                                   | Description                                                                                                                                                           | Required   |
| -------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| <p><strong>DefaultProvider</strong></p><p><strong>SubscriptionId</strong></p>    | Go to Admin Portal -> Login as Service Admin -> Subscriptions -> Default Provider Subscription -> Get the GUID                                                        | *Required* |
| **AdminArmEndpoint**                                                             | Admin ARM end point URL                                                                                                                                               | *Required* |
| <p><strong>ServiceAdminDirectory</strong></p><p><strong>TenantName</strong></p>  | Directory tenant name Of the service admin user                                                                                                                       | *Required* |
| **ServiceAdmin**                                                                 | Go to Admin Portal -> Login as Service Admin -> Subscriptions -> Default Provider Subscription -> Check if role is **Owner.** Eg: <admin@contosotest.onmicrosoft.com> | *Required* |
| <p><strong>ServiceTenantDirectory</strong></p><p><strong>TenantName</strong></p> | Directory tenant name Of the service tenant user. If not provided, ServiceAdminDirectoryTenantName will be used                                                       | *Optional* |
| **TenantSubscriptionId**                                                         | GUID of the Tenant Subscription where Cloud Assert components need to be deployed                                                                                     | *Required* |
| **ServiceTenant**                                                                | Tenant Subscription administrator account login user name. If not provided above ServiceAdmin credential can be used.                                                 | *Optional* |
| **VmLocalAdminUser**                                                             | SQL Server VM local admin user name. Eg: caadmin                                                                                                                      | *Required* |
| **VconnectDatabaseName**                                                         | Friendly name Eg: CloudAssert.VConnect                                                                                                                                | *Required* |
| **SqlUser**                                                                      | SQL Server authentication user name Eg: cadbadmin                                                                                                                     | *Required* |
| **SetupBillingAndDacm**                                                          | Set this value as **true** for installing Multi Stamp Management components                                                                                           | *Required* |
| **BillingDatabaseName**                                                          | Billing database name Eg: CloudAssert.Billing                                                                                                                         | *Required* |
| **DacmDatabaseName**                                                             | DACM database name Eg: CloudAssert.DACM                                                                                                                               | *Required* |
| **SqlPort**                                                                      | The default port is 1433. This can be changed if required.                                                                                                            | *Optional* |
| **Uninstall**                                                                    | For installation, no need to pass this parameter. For un-install, set it to **true** to un-install SQL server.                                                        | *Optional* |

SQL server installation and database creation may take 20-30 minutes.

4\. Once deployment successfully completes and VM successfully created, Go to **All Resources** -> Select the SQL Virtual Machine just created and note down the **Public IP Address**. (This is needed during installation to be passed to the scripts.)

![](/files/-MKJXh4UyiyQKh_rn4zV)

5\. Remote in to SQL server -> **SSMS** -> Login using the **SQL server authentication credential** provided in the above script during creation **\[Ensure the mode of signing in is SQL server authentication and NOT windows authentication]**&#x20;

6\. Verify following 3 databases are successfully created

![](/files/-M8B5JavqYPIwW1ITYlg)

7\. Verify SQL Inbound Rule is configured

Go to **Windows Firewall** -> **Inbound Rules** -> Verify SQL Inbound Rule for 1433 exists

![](/files/-M8BNoce8yKM1E2TDrka)

![](/files/-M8BM2DzyPI_dcOz1FnW)

![](/files/-M8BMBZOi3T-5rZRa_4n)

New SQL Server and necessary components are successfully created, please proceed to [Deployment](/azure-stack-hub-multi-stamp-management/2010.1/installation/deployment.md).&#x20;

### Step B. If using existing SQL Server, ensure inbound rule and necessary databases are created to proceed

1. Remote in to SQL server -> Windows Firewall -> Inbound Rules. Verify a SQL inbound rule allowing port 1433 exists

![](/files/-M8BNz6kPWH3SzyFAM80)

2\. If above rule is not present, follow below steps to create a new inbound rule

![](/files/-M8B3AnDQKUEN4jsXJBx)

![](/files/-M8B3CiJh94fXDYj7hk8)

![](/files/-M8B3EKTlMA0uL_5vaWO)

![](/files/-M8B3FviT2k9moGaJUcZ)

![](/files/-M8B3HiC1NN5J_QzIx93)

![](/files/-M8B3LiBBGzbWdPlLftX)

3\. Remote in to SQL server -> **SSMS** -> Login using the **SQL server authentication credential**  **\[Ensure the mode of signing in is SQL server authentication and NOT windows authentication]**&#x20;

4\. Create **3 new databases** named **CloudAssert.VConnect, CloudAssert.Billing, CloudAssert.DACM**

&#x20;       In **SQL Server** -> **Databases** -> Right Click -> **New Database...**

![](/files/-M8BDWUXUHdYC0pU6-Gb)
