Using Azure Open Service Broker for PCF

This topic describes how to use Azure Open Service Broker for Pivotal Cloud Foundry (PCF).

Before performing the procedures in this topic, ensure that you have installed the Cloud Foundry Command Line Interface (cf CLI).

List Services

  1. In a terminal window, run cf marketplace to list all the service offerings from the Azure Open Service Broker for PCF. It only lists the services which reach the Minimum Module Stability set in Broker Config. See the section Broker Config in Installing and Configuring Azure Open Service Broker for PCF topic.

  2. Run cf marketplace -s SERVICE to view the descriptions for the plans of a service.

Note: See the Azure Pricing topic to view pricing details for each service.

Create Service Instances

This section describes how to create service instances for the services offered by Azure Open Service Broker for Broker.

Azure Cosmos DB

Note: This module is preview and future releases may break the API.

This module provides new Cosmos DB database accounts by several services: azure-cosmosdb-sql, azure-cosmosdb-sql-account, azure-cosmosdb-sql-database, azure-cosmosdb-mongo-account, azure-cosmosdb-graph-account, and azure-cosmosdb-table-account, to be compatible with different APIs.

For more information, see this topic.

The following gives examples by azure-cosmosdb-sql.

Create

To create an Azure Cosmos DB service instance named mycosmosdb with the sql-api plan:

$ cf create-service azure-cosmosdb-sql-account sql-api mycosmos -c '{"resourceGroup":"osba", "location":"westus"}'

Bind

Bind the service instance mycosmosdb to an app.

$ cf bind-service myapp mycosmosdb

The credentials have the following format:

{
 "VCAP_SERVICES": {
  "azure-cosmosdb-sql": [
   {
    "credentials": {
     "databaseName": "fakedbname",
     "documentdb_database_id": "fakedbname",
     "documentdb_host_endpoint": "https://fake.documents.azure.com:443",
     "documentdb_master_key": "fakelongstring==",
     "primaryConnectionString": "AccountEndpoint=https://fake.documents.azure.com:443/;AccountKey=fakelongstring==;",
     "primaryKey": "fakelongstring==",
     "uri": "https://fake.documents.azure.com:443/"
    },
    "label": "azure-cosmosdb-sql",
    "name": "mycosmosdb",
    "plan": "sql-api",
    "provider": null,
    "syslog_drain_url": null,
    "tags": [
     "Azure",
     "CosmosDB",
     "Database",
     "SQL",
     "DocumentDB",
     "Gremlin",
     "Graph",
     "Table",
     "Key-Value"
    ],
    "volume_mounts": []
   }
  ]
 }
}

With service azure-cosmosdb-mongo-account, azure-cosmosdb-graph-account, and azure-cosmosdb-table-account, the credentials have the following format:

{
 "VCAP_SERVICES": {
  "azure-cosmosdb-mongo-account": [
   {
    "credentials": {
      "connectionstring": "AccountEndpoint=https://fake.documents.azure.com:443/;AccountKey=fakelongstring==;",
      "host": "https://fake.documents.azure.com:443",
      "password": "fakelongstring==",
      "port": 10255,
      "uri": "AccountEndpoint=https://fake.documents.azure.com:443/;AccountKey=fakelongstring==;",
      "username": "fake"
    },
    "label": "azure-cosmosdb-mongo-account",
    "name": "mycosmosdb",
    "plan": "account",
    "provider": null,
    "syslog_drain_url": null,
    "tags": [
     "Azure",
     "CosmosDB",
     "Database",
     "SQL",
     "DocumentDB",
     "Gremlin",
     "Graph",
     "Table",
     "Key-Value"
    ],
    "volume_mounts": []
   }
  ]
 }
}

You can get the credentials from ENV['VCAP_SERVICES'].

Note: Run cf unbind-service to remove the binding.

Azure Event Hubs

Note: This module is experimental and future releases may break the API.

This module provides a new Event Hubs namespace and a new hub within it.

For more information, see this topic.

Create

To create an Azure Event Hubs service instance named myeh with the standard plan:

$ cf create-service azure-eventhubs standard myeh -c '{"resourceGroup":"osba", "location":"westus"}'

Bind

Bind the service instance myeh to an app.

$ cf bind-service myapp myeh

The credentials have the following format:

{
 "VCAP_SERVICES": {
  "azure-eventhubs": [
   {
    "credentials": {
     "connectionString": "Endpoint=sb://fake.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=fakelongstring=",
     "primaryKey": "fakelongstring="
    },
    "label": "azure-eventhubs",
    "name": "myeh",
    "plan": "standard",
    "provider": null,
    "syslog_drain_url": null,
    "tags": [
     "Azure",
     "Event",
     "Hubs"
    ],
    "volume_mounts": []
   }
  ]
 }
}

You can get the credentials from ENV['VCAP_SERVICES'].

Note: Run cf unbind-service to remove the binding.

Azure Key Vault

Note: This module is experimental and future releases may break the API.

This module provides a new Key Vault.

For more information, see this topic.

Create

To create an Azure Key Vault service instance named mykv with the standard plan:

$ cf create-service azure-keyvault standard mykv -c '{"resourceGroup":"osba", "location":"westus", "clientId":"11111111-1111-1111-1111-111111111111", "clientSecret":"fakesecret", "objectid":"22222222-2222-2222-2222-222222222222"}'

Bind

Bind the service instance myeventhubs to an app.

$ cf bind-service myapp myeventhubs

The credentials have the following format:

{
 "VCAP_SERVICES": {
  "azure-keyvault": [
   {
    "credentials": {
     "clientId": "11111111-1111-1111-1111-111111111111",
     "clientSecret": "fakesecret",
     "vaultUri": "https://fake.vault.azure.net/"
    },
    "label": "azure-keyvault",
    "name": "mykv",
    "plan": "standard",
    "provider": null,
    "syslog_drain_url": null,
    "tags": [
     "Azure",
     "Key",
     "Vault"
    ],
    "volume_mounts": []
   }
  ]
 }
}

You can get the credentials from ENV['VCAP_SERVICES'].

Note: Run cf unbind-service to remove the binding.

Azure Database for MySQL

This module is split into three services. Service azure-mysql-5-7 provides a new MySQL DBMS and a new database upon it. Service azure-mysql-5-7-dbms provides an Azure Database for MySQL DBMS instance containing no databases. Service azure-mysql-5-7-database provides a new database upon a previously provisioned DBMS.

You can choose to create an independent DBMS instance for your new database with azure-mysql-5-7 or create databases with azure-mysql-5-7-database to share an azure-mysql-5-7-dbms.

For more information, see this topic.

The following gives an example of azure-mysql-5-7.

Create

To create an Azure Database for MySQL service instance named mymysql with the general-purpose plan:

$ cf create-service azure-mysql-5-7 general-purpose mymysql -c '{"resourceGroup":"osba", "location":"westus"}'

Bind

Bind the service instance mymysql to an app.

$ cf bind-service myapp mymysql

The credentials have the following format:

{
 "VCAP_SERVICES": {
  "azure-mysql-5-7": [
   {
    "credentials": {
     "database": "fakedb",
     "host": "fake.mysql.database.azure.com",
     "password": "fakepwd",
     "port": 3306,
     "sslRequired": true,
     "tags": [
      "mysql"
     ],
     "uri": "mysql://fakeuser:fakepwd@fake.mysql.database.azure.com:3306/fakedb?useSSL=true&requireSSL=true",
     "username": "fakeuser"
    },
    "label": "azure-mysql-5-7",
    "name": "mymysql",
    "plan": "general-purpose",
    "provider": null,
    "syslog_drain_url": null,
    "tags": [
     "Azure",
     "MySQL",
     "DBMS",
     "Server",
     "Database"
    ],
    "volume_mounts": []
   }
  ]
 }
}

You can get the credentials from ENV['VCAP_SERVICES'].

Note: Run cf unbind-service to remove the binding.

Azure Database for PostgreSQL

This module is split into three services. Service azure-postgresql-9-6 provides a new PostgreSQL DBMS and a new database upon it. Service azure-postgresql-9-6-dbms provides an Azure Database for PostgreSQL DBMS instance containing no databases. Service azure-postgresql-9-6-database provides a new database upon a previously provisioned DBMS.

You can choose to create an independent DBMS instance for your new database with azure-postgresql-9-6 or create databases with azure-postgresql-9-6-database to share an azure-postgresql-9-6-dbms.

For more information, see this topic.

The following gives an example of azure-postgresql-9-6.

Create

To create an Azure Database for PostgreSQL service instance named mypgsql with the general-purpose plan:

$ cf create-service azure-postgresql-9-6 general-purpose mypgsql -c '{"resourceGroup":"osba", "location":"westus"}'

Bind

Bind the service instance mypgsql to an app.

$ cf bind-service myapp mypgsql

The credentials have the following format:

{
 "VCAP_SERVICES": {
  "azure-postgresql-9-6": [
   {
    "credentials": {
     "database": "fakedb",
     "host": "fake.postgres.database.azure.com",
     "password": "fakepwd",
     "port": 5432,
     "sslRequired": true,
     "tags": [
      "postgresql"
     ],
     "uri": "postgresql://fakeuser:fakepwd@fake.postgres.database.azure.com:3306/fakedb?&sslmode=require",
     "username": "fakeuser"
    },
    "label": "azure-postgresql-9-6",
    "name": "mypgsql",
    "plan": "general-purpose",
    "provider": null,
    "syslog_drain_url": null,
    "tags": [
     "Azure",
     "PostgreSQL",
     "DBMS",
     "Server",
     "Database"
    ],
    "volume_mounts": []
   }
  ]
 }
}

You can get the credentials from ENV['VCAP_SERVICES'].

Note: Run cf unbind-service to remove the binding.

Azure Redis Cache

Note: This module is experimental and future releases may break the API.

This module provides a new Redis cache.

For more information, see this topic.

Create

To create an Azure Redis Cache service instance named myredis with the basic plan:

$ cf create-service azure-rediscache basic myredis -c '{"resourceGroup":"osba", "location":"westus"}'

Bind

Bind the service instance myredis to an app.

$ cf bind-service myapp myredis

The credentials have the following format:

{
 "VCAP_SERVICES": {
  "azure-rediscache": [
   {
    "credentials": {
     "host": "fake.redis.cache.windows.net",
     "password": "fakepwd=",
     "port": 6379
    },
    "label": "azure-rediscache",
    "name": "myredis",
    "plan": "basic",
    "provider": null,
    "syslog_drain_url": null,
    "tags": [
     "Azure",
     "Redis",
     "Cache",
     "Database"
    ],
    "volume_mounts": []
   }
  ]
 }
}

You can get the credentials from ENV['VCAP_SERVICES'].

Note: Run cf unbind-service to delete the binding.

Azure Service Bus

Note: This module is experimental and future releases may break the API.

This module provides a new Service Bus namespace.

For more information, see this topic.

Create

To create an Azure Service Bus service instance named mysb with the standard plan:

$ cf create-service azure-servicebus standard mysb -c '{"resourceGroup":"osba", "location":"westus"}'

Bind

Bind the service instance mysb to an app.

$ cf bind-service myapp mysb

The credentials have the following format:

{
 "VCAP_SERVICES": {
  "azure-servicebus": [
   {
    "credentials": {
     "connectionString": "Endpoint=sb://fake.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=fakekey=",
     "primaryKey": "fakekey="
    },
    "label": "azure-servicebus",
    "name": "mysb",
    "plan": "standard",
    "provider": null,
    "syslog_drain_url": null,
    "tags": [
     "Azure",
     "Service",
     "Bus"
    ],
    "volume_mounts": []
   }
  ]
 }
}

You can get the credentials from ENV['VCAP_SERVICES'].

Note: Run cf unbind-service to remove the binding.

Azure SQL Database

This module is split into three services. Service azure-sql-12-0 provides a new SQL Server and a new database upon it. Service azure-sql-12-0-dbms provides an Azure SQL Server containing no databases. Service azure-sql-12-0-database provides a new database upon a previously provisioned server.

You can choose to create an independent server for your new database with azure-sql-12-0 or create databases with azure-sql-12-0-database to share an azure-sql-12-0-dbms.

For more information, see this topic.

The following gives examples by azure-sql-12-0.

Create

To create an Azure SQL Database service instance named mymssql with the basic plan:

$ cf create-service azure-sql-12-0 basic mymssql -c '{"resourceGroup":"osba", "location":"westus"}'

Bind

Bind the service instance mymssql to an app.

$ cf bind-service myapp mymssql

The credentials have the following format:

{
 "VCAP_SERVICES": {
  "azure-sql-12-0": [
   {
    "credentials": {
     "database": "fakedb",
     "encrypt": true,
     "host": "fake.database.windows.net",
     "jdbcUrl": "jdbc:sqlserver://fake.database.windows.net:1433;database=obdoi2nws0;user=fakeuser;password=fakepwd;encrypt=true;trustServerCertificate=true;",
     "password": "fakepwd",
     "port": 1433,
     "tags": null,
     "uri": "sqlserver://fakeuser:fakepwd@fake.database.windows.net:1433/fakedb;encrypt=true;trustServerCertificate=true",
     "username": "fakeuser"
    },
    "label": "azure-sql-12-0",
    "name": "mymssql",
    "plan": "basic",
    "provider": null,
    "syslog_drain_url": null,
    "tags": [
     "Azure",
     "SQL",
     "DBMS",
     "Server",
     "Database"
    ],
    "volume_mounts": []
   }
  ]
 }
}

You can get the credentials from ENV['VCAP_SERVICES'].

Note: Run cf unbind-service to remove the binding.

Azure Storage

Note: This module is EXPERIMENTAL and future releases may break the API.

This module provides the storage resources indicated by the applicable plan and account only, or an account with a container.

For more information, see this topic.

Create

To create an Azure Storage service instance named mystorage with the general-purpose-storage-account plan:

$ cf create-service azure-storage general-purpose-storage-account mystorage -c '{"resourceGroup":"osba", "location":"westus"}'

Bind

Bind the service instance mystorage to an app.

$ cf bind-service myapp mystorage

The credentials have the following format:

{
 "VCAP_SERVICES": {
  "azure-storage": [
   {
    "credentials": {
     "accessKey": "fakekey==",
     "storageAccountName": "fake"
    },
    "label": "azure-storage",
    "name": "mystorage",
    "plan": "general-purpose-storage-account",
    "provider": null,
    "syslog_drain_url": null,
    "tags": [
     "Azure",
     "Storage"
    ],
    "volume_mounts": []
   }
  ]
 }
}

You can get the credentials from ENV['VCAP_SERVICES'].

Note: Run cf unbind-service to remove the binding.

Azure Text Analytics (Cognitive Services)

Note: This module is EXPERIMENTAL and future releases may break the API.

This module provides a Text Analytics API.

For more information, see this topic.

Create

To create an Azure Text Analytics service instance named mytextanalytics with the standard-s0 plan:

$ cf create-service azure-text-analytics standard-s0 mytextanalytics -c '{"resourceGroup":"osba", "location":"westus"}'

Bind

Bind the service instance mytextanalytics to an app.

$ cf bind-service myapp mytextanalytics

The credentials have the following format:

{
 "VCAP_SERVICES": {
  "azure-text-analytics": [
   {
    "credentials": {
     "textAnalyticsEndpoint": "fakeendpoint",
     "textAnalyticsKey": "fakekey",
     "textAnalyticsName": "fakename"
    },
    "label": "azure-text-analytics",
    "name": "mytextanalytics",
    "plan": "standard-s0",
    "provider": null,
    "syslog_drain_url": null,
    "tags": [
     "Azure",
     "Cognitive",
     "Text Analytics",
     "Analytics"
    ],
    "volume_mounts": []
   }
  ]
 }
}

You can get the credentials from ENV['VCAP_SERVICES'].

Note: Run cf unbind-service to remove the binding.

Delete a Service Instance

Note: Before deleting a service instance, ensure there are no apps bound to the service instance and no data contained within, such as objects in a storage account.

Run the following command to delete a service instance:

$ cf delete-service YOUR-SERVICE-INSTANCE
Really delete the service YOUR-SERVICE-INSTANCE> y
Deleting service YOUR-SERVICE-INSTANCE in org system / space dev1 as appdev1...
OK
Delete in progress. Use 'cf services' or 'cf service YOUR-SERVICE-INSTANCE' to check operation status.
Create a pull request or raise an issue on the source for this page in GitHub