Welcome to the Linux Foundation Forum!

Is it possible to retrieve service credentials from an UPSI?

The service credentials are not displayed by cf service SERVICE_INSTANCE.

Sometimes I forget the purpose of my UPSI, for which having a look at the credentials can give some hints.

The workaround I have found so far is printing the environment variables of an app bound to the service (cf env APP_NAME), but I would like to know if there's a simpler approach.

Thanks!

Comments

  • spgreenberg
    spgreenberg Posts: 86
    edited January 2021

    Unfortunately, there is not a command in the cf cli. You can use cf env with a bound app. Or you can query the API using cf curl for instances that are not bound to any apps. This involves two steps:

    svc_instance_guid=$(cf service --guid SERVICE_INSTANCE)              # fetch the guid for the service instance
    cf curl "/v3/service_instances/${svc_instance_guid}/credentials"   # get the creds (values)
    

    Note I wrote this in the unix centric-way. The first command stores the guid in a variable called $svc_instance_guid. This is optional as you could just make the cf service --guid SERVICE_INSTANCE call and cut/paste the output into the curl command in place of ${svc_instance_guid}.

  • This helps a lot. Thanks!

Categories

Upcoming Training