Getting Bluemix info for Support and Automation

Note: I added a section to this on April 10, 2017 on creating an org within your Bluemix account.  This was also published on IBM DeveloperWorks on April 13, 2017.

I like writing blogs, and I find that the inspiration for many of my blog posts is the fact that I hate answering the same question twice.  So when I was recently asked to help out a customer who needed some help in dealing with Bluemix support, I found myself answering a similar question to one I have found myself answering often in these circumstances.

The issue is that when working with Bluemix, the interface hides a lot of the complexity of managing a Cloud platform from the end user.  That’s good – I don’t really care what my org ID is (assuming that I even know exactly what an org ID is).  However, our Bluemix support teams often have to work “behind the scenes” in Bluemix, and they need to know things like org ID’s, instance ID’s, and service ID’s.  They will often ask for this information, and our customers have no idea how to get it.  So just follow along here, and you’ll be able to get all of that information (and more).

Setting Up

In order to get this information, you will need to use command line interpreter (CLI) tools.  There are two of them: the CloudFoundry CLI, and the Bluemix CLI.  In this example below, I show how to use the Bluemix CLI to get this information, but if you watch your terminal session, you can see how you would do things using the Cloud Foundry CLI, because the Bluemix CLI will tell you what Cloud Foundry commands it is invoking.

So to get started, you will need to install the CloudFoundry and Bluemix command line tools (download them here). 

Need to Setup a New Bluemix Org?

Some of you may want or need to set up a new Bluemix org under your account.  This cannot be done if you have a trial account, but if you have a pay-as-you-go account or Bluemix/Watson subscription, then you will be able to do this.  Just type in the following commands using the CloudFoundry command line tool:

  • Set the API endpoint
bluemix api https://api.ng.bluemix.net
  • Login to CloudFoundry
bluemix login -u <YOUR_USERID> -p <YOUR_PASSWORD> -s <YOUR_BLUEMIX_SPACE>

(I used cf login -u dtoczala@us.ibm.com -p myBig$ecret -s dev)

  • Now create your new org in your Bluemix workspace
bluemix iam org-create <NEW_ORG_NAME>

And then check to see if your new org was properly created.

Finding Out Your “Secret” Identifiers

Now you’re ready to find all of those obscure and hidden ID’s that support people are asking for.  Make sure that you have the Bluemix and CloudFoundry CLI’s downloaded and installed on your system.  Then you can do the following from the command line:

  • Set the API endpoint
bluemix api https://api.ng.bluemix.net
  • Login to Bluemix
bluemix login -u <YOUR_USERID> -p <YOUR_PASSWORD> -s <YOUR_BLUEMIX_SPACE>

(I used bluemix login -u dtoczala@us.ibm.com -p myBig$ecret -s dev)

  • Now see what orgs are out there in your Bluemix workspace
bluemix iam orgs

Check the list and get the name of the org that you are interested in

  • Now get more information on that org – just for fun
bluemix iam org <YOUR_ORG_NAME>

(I used bluemix iam org dtoczala@us.ibm.com)

  • Now get the Org ID information on that org – just add the –guid switch
bluemix iam org <YOUR_ORG_NAME> --guid

(I used bluemix iam org dtoczala@us.ibm.com –guid)

Copy/paste the returned information – this is your org ID.

  • Now lets get a service instance ID.  Start by getting a list of your services
bluemix service list

Get the name of the service in question (I pulled a Watson Conversation service)

  • Now get some more information on that service – just for fun
bluemix service show <YOUR_SERVICE_NAME>

(I used bluemix service show ToxSampleConversation)

  • Now get the Instance ID information on that service – just add the –guid switch
bluemix service show <YOUR_SERVICE_NAME> --guid

(I used bluemix service show ToxSampleConversation –guid)

Copy/paste the returned information – this is your service instance ID.

Summary

  It is pretty simple to get information about your Bluemix account using these CLI tools.  You can use them from a terminal, but they also work from within shell scripts, allowing you to automate reports and anything else that you might frequently want to do on Bluemix.  Check out the Bluemix CLI Reference page and the CloudFoundry CLI Reference page for more CLI commands that you can use to get information for your Bluemix account, and your Bluemix services.