This topic describes moving a MSSQL database Failover Group (FoG) 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, in this case, the legacy MSSQL broker tile, to another is called subsuming the instance.

About Subsuming an MSSQL Database Failover Group (FoG) Instance

Because the Microsoft Azure Service Broker (MASB) for VMware Tanzu tile is going out of support, it is important to move MSSQL database FoG 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 FoG 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 FoG 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 FoG database.

Prerequisites

Before you subsume a FoG instance, you must have:

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

  • The names of the primary server and secondary server that are joined to the FoG. You can find these names in the Azure portal.

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

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

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

    cf service MASB-DATABASE-INSTANCE
    

    Where MASB-DATABASE-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 MASB-brokered FoG instance details by running:

    cf service MASB-FOG-INSTANCE
    

    Where MASB-FOG-INSTANCE is the name of the MAS-brokered FoG instance.

    For example:

    $ cf service masb-fog-db-80124
    Showing info of service masb-fog-db-80124 in org pivotal / space ernie as admin...
    
    name:            masb-fog-db-80124
    service:         azure-sqldb-failover-group
    tags:
    plan:            SecondaryDatabaseWithFailoverGroup
    description:     Azure SQL Database Failover Group Service
    documentation:
    dashboard:
    
    Showing status of last operation from service masb-fog-db-80124...
    
    status:    create succeeded
    message:   Created failover group masb-fog-db-80124.
    started:   2020-11-11T00:39:40Z
    updated:   2020-11-11T00:41:44Z
    
    There are no bound apps for this service.
    
  3. Get the Azure resource IDs for the FoG and its databases by running the following on the Azure CLI:

    Primary database ID:

    az sql db show --name DATABASE-NAME --server PRIMARY-SERVER-NAME \
    --resource-group FOG-RESOURCE-GROUP --query databases[0] -o tsv
    

    Secondary database ID:

    az sql db show --name DATABASE-NAME --server SECONDARY-SERVER-NAME \
    --resource-group FOG-RESOURCE-GROUP --query databases[0] -o tsv
    

    FoG ID:

    az sql failover-group show --name FOG-NAME --server PRIMARY-SERVER-NAME \
    --resource-group FOG-RESOURCE-GROUP --query id -o tsv
    

    Where:

    • DATABASE-NAME is the logical database name in the message line of the output from running cf service MASB-DATABASE-INSTANCE in the step above.
    • PRIMARY-SERVER-NAME and SECONDARY-SERVER-NAME are the server names joined to the FoG.
    • FOG-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.
    • FOG-NAME is the logical name in the message line of the output from running cf service MASB-FOG-INSTANCE in the step above.

      For example:

      $ az sql failover-group show --name masb-fog-db-80124 --server server-name \
        --resource-group azure-service-broker --query id -o tsv
      /subscriptions/000abc00-0000-00ab-0abc-00000000/resourceGroups/resource-group/providers/Microsoft.Sql/servers/server-name/databases/database-name
      

    The entire output of each of the three commands replaces the -AZURE-DB-ID variables in step 5 below.

  4. (If you added the credentials for the 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-brokered 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.

    Note: Adding the credentials with environment variables is only for testing. This is 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_FOG_SERVER_PAIR_CREDS '{"SERVER-PAIR-LABEL":{"admin_password":"SERVER-ADMIN-PASSWORD","admin_username":"SERVER-ADMIN-USERNAME","primary":{"resource_group":"PRIMARY-SERVER-RESOURCE-GROUP","server_name":"PRIMARY-SERVER-NAME"},"secondary":{"resource_group":"SECONDARY-SERVER-RESOURCE-GROUP","server_name":"SECONDARY-SERVER-NAME"}}}''
    
    cf set-env CLOUD-SERVICE-BROKER-APP GSB_SERVICE_CSB_AZURE_MSSQL_DB_FAILOVER_GROUP_PROVISION_DEFAULTS '{"server_credential_pairs":{"SERVER-PAIR-LABEL":{"admin_password":"SERVER-ADMIN-PASSWORD","admin_username":"SERVER-ADMIN-USERNAME","primary":{"resource_group":"PRIMARY-SERVER-RESOURCE-GROUP","server_name":"PRIMARY-SERVER-NAME"},"secondary":{"resource_group":"SECONDARY-SERVER-RESOURCE-GROUP","server_name":"SECONDARY-SERVER-NAME"}}}}'
    
    cf restage CLOUD-SERVICE-BROKER-APP
    

    Where:

    • CLOUD-SERVICE-BROKER-APP is the name of the Cloud Service Broker for Azure app.
    • MSSQL_DB_FOG_SERVER_PAIR_CREDS and GSB_SERVICE_CSB_AZURE_MSSQL_DB_FAILOVER_GROUP_PROVISION_DEFAULTS are literal environment variable name that should be typed as written.
    • SERVER-PAIR-LABEL is a label to use to refer to the pairing of the primary and secondary server. If there is more than one server pair, combine the credentials into the same JSON object.

      For example:

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

    • SERVER-ADMIN-USERNAME is the administrative username for the primary server.
    • PRIMARY-SERVER-RESOURCE-GROUP and SECONDARY-SERVER-RESOURCE-GROUP are the resource groups in which the primary and secondary database servers reside.
    • PRIMARY-SERVER-NAME and SECONDARY-SERVER-NAME are the names of the primary and secondary database servers.
  5. Create a new MSSQL service instance using Cloud Service Broker for Azure and import the existing MSSQL FoG resource by choosing the “subsume” plan and including the metadata as shown:

    cf create-service csb-azure-mssql-db-failover-group subsume NEW-SERVICE-INSTANCE -c
        '{
      "azure_primary_db_id": "PRIMARY-AZURE-DB-ID",
      "azure_secondary_db_id": "SECONDARY-AZURE-DB-ID",
      "auzure_fog_id": "FOG-AZURE-ID",
      "server_pair": "SERVER-PAIR-LABEL"
    }'
    

    Where:

    • NEW-SERVICE-INSTANCE is a name you choose for the new service instance to replace the MSAB service instance.
    • PRIMARY-AZURE-DB-ID , SECONDARY-AZURE-DB-ID and FOG-AZURE-ID are found in the outputs of step 3 above.
    • SERVER-PAIR-LABEL is the same as in the previous step.
  6. 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
  7. 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 5 above.

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

  8. Restage the app:

    cf restage APP-NAME
    
  9. 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

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

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