How to find my own organization id? - ibm-cloud

In many of the APIs for Bluemix, I need to know my "organization id" which I believe to be different from the "name" of my organization. When I login to the Bluemix dashboard, I am unable to find my organization id value. What is the recommended set of steps to determine my own organization id value?

You can use the cf command line tool for this:
$ cf org <org-name> --guid
You can also see it in the Bluemix dashboard browser URL, like for example (I modified mine below for security reasons):
https://console.ng.bluemix.net/?direct=classic/#/resources/cloudOEPaneId=resources&orgGuid=xxxxxxxx-8afc-4b2f-afb5-dc7d77dd0baa&spaceGuid=xxxxxxx-2c29-4d8a-9e97-06aed

Related

Is there an IBM Cloud API call to retreive the account name?

The account settings page (Manage > Account > Account Settings) lists an account ID and an account name under the "Account" heading. The account ID is easy enough to retrieve using the API, but I've not found a way to get the account name. Is this possible to get using the API?
I've been looking at the IBM Cloud API Docs and at the Softlayer API docs but haven't been able to find something which returns the account name.
The ibmcloud CLI returns the info, but I'd rather not have to use the CLI since this will be used from within a Python app.
You can always use IBMCLOUD_TRACE=true on the CLI to find out what the ibmcloud command is doing. What you see as "account name" is the ID resolved by going to the user management API.

How do I log in to kubernetes-cockpit UI if .kube/config contains a token instead of an account?

Numerous forum posts and documentations specify extracting login info for the Kubernetes install from ~/.kube/config.
The problem I found: mine doesn't have a proper user account, it specifies a name and a token.
How do I get the account name so I can use the kubernetes-cockpit UI? Surprisingly there appears to be nothing on that topic - what to do if the config doesn't contain an account.
It depends on how you use Cockpit.
According to cockpit official page:
Used in a standard cockpit session:
If a user is able to use kubectl successfully when at their shell terminal, then that same user will able to use Kubernetes dashboard when logged into Cockpit
I suppose this is your scenario, so if you didn't change default settings, the cockpit will look for .kube/config itself, i.e. you should be able to login without specifying your account.

Couldn't target the organization using CF CLI

I am learning to use Bluemix and was trying to access my application using the Cloud Foundry command-line interface. But after logging in using my Bluemix ID at the CF CLI, I am not able to target the organization. On the Bluemix dashboard in my browser, the organization is visible. Is there a bug?
After running cf login some organisation should have been set as the target.
Run cf target to get the current target information
Run cf orgs to get the available organisations
Run cf spaces to get the available spaces in the organisation
Run cf target -o organisation_name -s space_name to target the correct organisation and space
Each organisation can have multiple spaces. Each space can have multiple applications. With the correct organisation and space set as targets the currently deployed applications can be listed with cf apps.
Organisations can span regions but may not. Check if the organisation is present in other regions by changing the API endpoint.
US South https://api.ng.bluemix.net
UK https://api.eu-gb.bluemix.net
Sydney https://api.au-syd.bluemix.net
change the region API endpoint to the region that appears in your account

How do I remove or rename a Bluemix organization after a name change?

I try to remove my organization executing this command:
1) Change the original organization name from miguel#thingtrack.com to Miguel correctly from the Dashboard.
1) Login in my bluemix account correctly from CLI like this:
bluemix login
2) Try to remove my unique organization called Miguel:
bluemix iam org-delete Miguel
The error result is:
Suprimiendo la organizaciĆ³n Miguel como miguel#thingtrack.com...
FAILED
Error response from server. StatusCode: 500; description: multiple documents found containing guid 7f1f9939-b0bc-4e61-85b9-d7e3744b6c77: [{"_id":"org.Miguel","_rev":"3-9b1bba6c8f8c618ba424c728e55ee247","customer":"ibm","deployment":"yp","name":"Miguel","type":"org","value":{"ibm:yp:eu-gb":{"guid":"6b7219e6-5992-4d43-ac52-083bf0ce8d50","owner":true},"ibm:yp:us-south":{"guid":"7f1f9939-b0bc-4e61-85b9-d7e3744b6c77"}},"created_at":"2016-05-23T13:49:36.660Z","updated_at":"2016-09-09T17:50:02.846Z","migrated":true},{"_id":"org.miguel#thingtrack.com","_rev":"2-cf26e55555fe9730b4a9a9a4525f4bf3","customer":"ibm","deployment":"yp","name":"miguel#thingtrack.com","type":"org","value":{"ibm:yp:us-south":{"guid":"7f1f9939-b0bc-4e61-85b9-d7e3744b6c77","owner":true}},"created_at":"2015-08-28T09:49:49.221Z","updated_at":"2016-08-13T18:06:03.994Z","migrated":true}]
Also I noticed that if I try to rename again the organization to other name I obtain the same error.
So in my opinion if you change the organization name one time, you will never remove it or change the name never more.
Is it a bug of bluemix??
Regards
Bluemix does not allow users to delete organizations. Per documentation you have to contact Bluemix Support team to delete the organization on your behalf.
From Bluemix documentation:
You must contact Bluemix Support to delete an organization. When you
request for the support team to delete an organization, all the
spaces, applications, and services within the organization are
deleted.
You can find more details here: https://console.ng.bluemix.net/docs/admin/orgs_spaces.html#orginfo
Actually, Miguel Salinas is correct. You can now rename or delete orgs from the Bluemix CLI using commands such as:
bluemix iam org-rename <old_org_name> <new_org_name>
bluemix iam org-delete <org_name>
Here's the reference to the bluemix commands:
https://www.ng.bluemix.net/docs/cli/reference/bluemix_cli/index.html
The documentation snippet mentioned above by Alex is outdated and need to be revised. I'll send them this feedback.
I know I am late to the party, but I hope this helps the future users.
You can rename org using the bluemix cli as #marcel Ribas stated above.
bluemix iam org-rename old_org_name new_org_name
bluemix iam org-delete org_name
Alternatively you can go into your bluemix account and you have and option to change org name under the manange organizations tab. Just click on edit button next to org name and make the changes
Note- You need to have manager level access to the org you are trying to rename. You can check this on your bluemix account under the manage organizations tab

How do I manage org and space users in bluemix using cf command line?

Bluemix provides a CF command line for download to manage applications.
We want to use CF (or any other command line tools ) to manage Organization and Space users. This will allow us to programmatically sync the user list.
Specifically I am looking for
cf enroll-user
cf add-user
cf remove-user
cf unenroll-use
the cf command already lists the users for a given ORG and SPACE.
The simple answer is to read the docs. See "Creating and Managing Users with the cf CLI." It documents commands like create-user, set-org-role, and set-space-role.
For example: Use cf create-user USERNAME PASSWORD to create a new user. The problem is, when you try to do this in Bluemix, you get an error:
>cf create-user jdoe password
Creating user jdoe as bwoolf...
FAILED
Error creating user jdoe.
Server error, status code: 403, error code: access_denied, message: Invalid token does not contain resource id (scim)
You get a similar error when you try to run set-org-role or set-space-role:
FAILED
Server error, status code: 403: Access is denied. You do not have privileges to execute this command.
Why did you get this error? Like #RandalAnders explained, Bluemix currently blocks users from using these user administration commands in the CF CLI. For the time being, you'll need to perform these actions using the Bluemix Dashboard.
Currently, it is not possible within Bluemix to use the CF CLI for certain management commands, as they require administrative privileges. We are exploring expanding the scope of the commands used in the CLI and would be interested in hearing any other use cases you may have.
you can not create a user on bluemix using cf cli since it needs admin privileges. To add a user, you will need to use bluemix cli 'bluemix iam account-user-invite' to invite a user to your account with a org/space role assigned. There are other account/org/space/role management commands under 'bluemix iam'.
Download bluemix CLI here: http://clis.ng.bluemix.net