<commit_before>---
title: Managing Service Brokers
---

<strong><%= modified_date %></strong>

_This page assumes you are using cf CLI v6._

In order to run any of the commands below, you must be authenticated with Cloud
Foundry as an admin user.

## <a id='quick-start'></a>Quick Start ##

Given a service broker that has implemented the [Service Broker API](api.html), two steps are required to make its services available to end users.

1. [Register a Broker](#register-broker)
1. [Make Plans Public](#make-plans-public)

## <a id='register-broker'></a>Register a Broker ##

Registering a broker causes Cloud Controller to fetch and validate the catalog
from your broker, and save the catalog to the Cloud Controller database.
The basic auth username and password which are provided when adding a broker are
encrypted in Cloud Controller database, and used by the Cloud Controller to
authenticate with the broker when making all API calls.
Your service broker should validate the username and password sent in every
request; otherwise, anyone could curl your broker to delete service instances.

<pre class="terminal">
$ cf create-service-broker mybrokername someuser somethingsecure http://mybroker.example.com/
</pre>

### <a id='make-plans-public'></a>Make Plans Public ###
New service plans are private by default.
To make plans available to end users, see [Make Plans Public](./access-control.html#enable-access).
Instances of a private plan can not be provisioned until either the plan is made
public or is made available to an organization.

### <a id='multiple-brokers'></a>Multiple Brokers, Services, Plans ###

Many service brokers may be added to a Cloud Foundry instance, each offering
many services and plans.
The following constraints should be kept in mind:

- It is not possible to have multiple brokers with the same name
- It is not possible to have multiple brokers with the same base URL
- The service ID and plan IDs of each service advertised by the broker must be unique across Cloud Foundry. GUIDs are recommended for these fields.

See [Possible Errors](#possible-errors) below for error messages and what do to
when you see them.

## <a id='list-brokers'></a> List Service Brokers ##

<pre class="terminal">
$ cf service-brokers
Getting service brokers as admin...Cloud Controller
OK

Name            URL<commit_msg>Adding space scoped private brokers<commit_after>---
title: Managing Service Brokers
---

<strong><%= modified_date %></strong>

_This page assumes you are using cf CLI v6.16

In order to run many of the commands below, you must be authenticated with Cloud
Foundry as an admin user.

In order to manage Space Scoped Private Service Brokers, you must be authenticated with Cloud Foundry as a space developer or as an admin user.

## <a id='quick-start'></a>Quick Start ##

Given a service broker that has implemented the [Service Broker API](api.html), two steps are required to make its services available to end users in all organizations or a limited number of organizations by service plan.

1. [Register a Broker](#register-broker)
1. [Make Plans Public](#make-plans-public)

Support for Space Scoped Private Brokers has been added as of cf-release 229, CC API 2.47.0.  Service Plans for Space Scoped Private Brokers are by default visible to all space users in the space the Private Broker has been registered to.

## <a id='register-broker'></a>Register a Broker ##

Registering a broker causes Cloud Controller to fetch and validate the catalog
from your broker, and save the catalog to the Cloud Controller database.
The basic auth username and password which are provided when adding a broker are
encrypted in Cloud Controller database, and used by the Cloud Controller to
authenticate with the broker when making all API calls.
Your service broker should validate the username and password sent in every
request; otherwise, anyone could curl your broker to delete service instances.

### Standard Private Brokers ###

<pre class="terminal">
$ cf create-service-broker mybrokername someuser somethingsecure http://mybroker.example.com/
</pre>

### Space Scoped Private Brokers ###

<pre class="terminal">
$ cf create-service-broker mybrokername someuser somethingsecure http://mybroker.example.com/ --space-scoped
</pre>


### <a id='make-plans-public'></a>Make Plans Public ###
New service plans are private by default.
To make plans available to end users, see [Make Plans Public](./access-control.html#enable-access).
Instances of a private plan can not be provisioned until either the plan is made
public or is made available to an organization.
For Space Scoped Private Brokers, this step is not necessary as all plans will be made visible to the space the broker is registered to.  
It is not possible to manage visibility of a Space Scoped Private Broker at the Cloud Foundry instance or organization level.

### <a id='multiple-brokers'></a>Multiple Brokers, Services, Plans ###

Many service brokers may be added to a Cloud Foundry instance, each offering
many services and plans.
The following constraints should be kept in mind:

- It is not possible to have multiple brokers with the same name
- It is not possible to have multiple brokers with the same base URL
- The service ID and plan IDs of each service advertised by the broker must be unique across Cloud Foundry. GUIDs are recommended for these fields.

See [Possible Errors](#possible-errors) below for error messages and what do to
when you see them.

## <a id='list-brokers'></a> List Service Brokers ##

<pre class="terminal">
$ cf service-brokers
Getting service brokers as admin...Cloud Controller
OK

Name            URL
{'fraction_non_alphanumeric': 0.07131481153778092, 'fraction_numerical': 0.0026543974517784464, 'mean_word_length': 4.49271137026239, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1064506', 'n_tokens_mistral': 1469, 'n_tokens_neox': 1416, 'n_words': 792}