This topic describes moving an MSSQL database instance from the Microsoft Azure Service Broker for VMware Tanzu tile to the Tanzu Cloud Service Broker for Azure tile.

This process of moving control of an instance from one broker tile to another is called subsuming the instance.

About Subsuming an MSSQL Database Instance

Because the Microsoft Azure Service Broker (MASB) for VMware Tanzu tile is going out of support, it is important to move MSSQL database instances that were created by the MASB over to the Cloud Service Broker for Azure.

Subsuming the instance allows you to move the database from the control of one broker to the control of another without migrating the data.

After the subsuming process, you can manage the instance and the associated MSSQL database just like any other service instance.

For general information about the Microsoft Azure Service Broker for VMware Tanzu tile, see Azure Service Broker.

Overview of the Process

Detailed steps for subsuming are given below. However, the outline of the process is:

  • Import information about the MSSQL database instance using the “subsume” plan in the Cloud Foundry Marketplace.
  • Unbind apps from the old MAS-brokered instance.
  • Bind apps to the new Cloud Service Broker for Azure instance.
  • Purge the connections between the old MAS-brokered instance and the MSSQL database. Do not delete service instances.
  • Restage any apps which were connected to the legacy database.

Prerequisite

Cloud Service Broker for Azure installed and configured. For instructions, see Broker Config in Installing and Configuring Microsoft Azure Service Broker.

Subsume a Microsoft Azure Service Broker (MASB) MSSQL Database Instance

To subsume control of an existing MASB MSSQL database instance to the Cloud Service Broker for Azure:

  1. Get the MAS-brokered database instance details by running:

    cf service MASB-SERVICE-INSTANCE
    

    Where MASB-SERVICE-INSTANCE is the name of the MAS-brokered database instance.

    For example:

    $ cf service masb-instance
    Showing info of service <masb instance> in org ...
    
    name:            masb-instance
    service:         azure-sqldb
    tags:
    plan:            basic
    description:     Azure SQL Database Service
    documentation:
    dashboard:
    
    Showing status of last operation from service masb-instance...
    
    status:    create succeeded
    message:   Created logical database my-database on logical server my-server.
    started:   2020-08-20T21:06:57Z
    updated:   2020-08-20T21:08:04Z
    
  2. Get the Azure resource ID for the database by running the following on the Azure CLI:

    az sql db show --name DATABASE-NAME --server SERVER-NAME \
    --resource-group SERVER-RESOURCE-GROUP --query id -o tsv
    

    Where:

    • DATABASE-NAME and SERVER-NAME are the logical names in the message line of the output in the step above.
    • SERVER-RESOURCE-GROUP is the Default Resource Group in the Default Parameters Config pane of the Azure Service Broker tile. See Default Parameters Config in Installing and Configuring Microsoft Azure Service Broker.

    For example:

    $ az sql db show --name my-database --server my-server \
      --resource-group azure-service-broker --query id -o tsv
    
    /subscriptions/000abc00-0000-00ab-0abc-00000000/resourceGroups/resource-group/providers/Microsoft.Sql/servers/my-server/databases/my-database
    
  3. (If you added the credentials for the MASB pre-configured servers when you configured Cloud Service Broker for Azure, in Configure Services with Cloud Service Broker for Azure, then skip this step.)

    Add credentials for the MASB pre-existing servers by following step 3 in Configure Services with Cloud Service Broker for Azure or temporarily add the credentials with environment variables as follows. Adding the credentials with environment variables is only for testing, because the credentials are lost when you apply changes to the tile.

    Note: You only need to do this configuration once for each server. If you have already done this configuration for a database server, you do not have to do it again.


    cf set-env CLOUD-SERVICE-BROKER-APP MSSQL_DB_SERVER_CREDS '{"SERVER-LABEL":{"admin_password":"SERVER-ADMIN-PASSWORD","admin_username":"SERVER-ADMIN-USERNAME","server_name":"SERVER-NAME","server_resource_group":"SERVER-RESOURCE-GROUP"}}'
    
    cf restage CLOUD-SERVICE-BROKER-APP
    

    Where:

    • CLOUD-SERVICE-BROKER-APP is the name of the Cloud Service Broker for Azure app.
    • MSSQL_DB_SERVER_CREDS and GSB_SERVICE_CSB_AZURE_MSSQL_DB_PROVISION_DEFAULTS are literal environment variable names, that should be typed as written.
    • SERVER-LABEL is a label to use to refer to the server, which might be the same as the logical server name. If there is more than one server, combine the credentials into the same JSON object. For example:

      {"SERVER-LABEL-1":{"admin_password": ... }, "SERVER-LABEL-2":{"admin_password": ... }}
      
    • SERVER-ADMIN-PASSWORD is the administrative password for the server.

    • SERVER-ADMIN-USERNAME is the administrative username for the server.
    • SERVER-NAME is the same as the previous step.
    • SERVER-RESOURCE-GROUP is the same as the previous step.
  4. Create a new MSSQL service instance using Cloud Service Broker for Azure and import the existing MSSQL resource by choosing the “subsume” plan and including the metadata as shown:

    cf create-service csb-azure-mssql-db subsume NEW-SERVICE-INSTANCE \
    -c '{"azure_db_id", "AZURE-RESOURCE-ID", "server": "SERVER-LABEL"}'
    

    Where:

    • NEW-SERVICE-INSTANCE is a name you choose for the new service instance that Cloud Service Broker for Azure creates to replace the MSAB service instance.
    • AZURE-RESOURCE-ID is the output of the az sql db show command in the previous step.
    • SERVER-LABEL is the same as the previous step.

    For example:

    $ cf create-service csb-azure-mssql-db subsume secondary-db \
      -c '{"azure_db_id":"/subscriptions/000abc00-0000-00ab-0abc-00000000/resourceGroups/resource-group/providers/Microsoft.Sql/servers/my-server/databases/my-database", "server": "server-1", "server-name": "my-server"}'
    
  5. Disconnect the app from the MASB service binding by running:

    cf unbind-service APP-NAME MASB-SERVICE-INSTANCE
    

    Where:

    • APP-NAME is the app using the database.
    • MASB-SERVICE-INSTANCE is the name of the MAS-brokered database instance.

    For example:

    $ cf unbind-service my-app masb-instance
    
  6. Bind the app to the new service instance by running:

    cf bind-service APP-NAME NEW-SERVICE-INSTANCE
    

    Where NEW-SERVICE-INSTANCE is the name of the Cloud Service Broker for Azure service instance that you created in step 4 above.

    For example:

    $ cf bind-service my-app secondary-db
    

    Because Cloud Service Broker for Azure creates new credentials at bind time, this creates new binding credentials for the app.

  7. Restage the app:

    cf restage APP-NAME
    
  8. Remove record of the old MAS-brokered database instance and any child objects from Cloud Foundry by running:

    cf purge-service-instance MASB-SERVICE-INSTANCE
    

    For example:

    $ cf purge-service-instance masb-instance

    Caution Do not run cf delete-service because then the Microsoft Azure Service Broker deletes the Azure MSSQL resource, that is, the database.

  9. Update the service instance to use a plan that closely matches the configuration of the plan that the MAS-brokered instance used by running:

    cf update-service NEW-SERVICE-INSTANCE -p PLAN-NAME
    

    Where PLAN-NAME is the name of the plan. You can use one of the default plans or a custom plan. Update instances to a plan other than subsume so that Cloud Service Broker for Azure can manage them.

    Note: Changing the plan updates the service instance to adopt the characteristics of that plan, such as CPU and storage size.

Next Steps

When all MAS-brokered service instances for all apps have been moved to Cloud Service-brokered instances, you can uninstall the Microsoft Azure Service Broker for VMware Tanzu tile from Ops Manager.

check-circle-line exclamation-circle-line close-line
Scroll to top icon