- Community Home
- >
- Software
- >
- HPE Morpheus Software
- >
- HPE Morpheus Enterprise
- >
- How can I find out the actual Tenant and read the ...
Categories
Company
Local Language
Forums
Discussions
Knowledge Base
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Knowledge Base
Forums
Discussions
- Cloud Mentoring and Education
- Software - General
- HPE OneView
- HPE Ezmeral Software platform
- HPE OpsRamp
Knowledge Base
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2024 09:48 AM
07-17-2024 09:48 AM
We are running a Master Tenant and several Sub Tenants. All tenants are created with the Advanced Options of Account Number, Account Name and Customer Number. We need this information very early in a Provisiong Workflow - Configuration Phase to set a Hostname based on the Customer Number for the Spec.
We are running a Powershell script in that Workflow and read the Customer Number with a Rest API call on the endpoint “/api/accounts&name=customerName”. Unfortunately, we only found out how to fill the variable customerName manually before the script runs - that is, we put in the appropriate Tenant Name from case to case depending on the Tenant where we are logged in…
We could not figure out how to read the actual Tenant Name where we are logged into automatically. Within “Edit Task” of the Powershell script we saw variables like <%=tenant%> or <%=account%>, but we could not manage to deliver output from those.
Is there any way to find out the Tenant Name where I am actually logged in and read the Customer Number, both automatically in a script?
Any idea or help is greatly appreciated!
Thank you,
Kai
Solved! Go to Solution.
- Tags:
- tenants
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2024 10:21 AM
07-17-2024 10:21 AM
Re: How can I find out the actual Tenant and read the Customer Number?
Hi Kai. It looks like accountNumber is available as a pre-provision var for instance and host naming, so could a hostname policy help, or at least give you the data and you then mutate it?
I’m sure I’ve missed some of the nuance, but just wanted to flag that, in case you haven’t seen the resource.
I work at HPE
HPE Support Center offers support for your HPE services and products when and how you need it. Get started with HPE Support Center today.
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2024 09:09 AM
07-19-2024 09:09 AM
Re: How can I find out the actual Tenant and read the Customer Number?
Hi Chris,
I have tested the code lines within my environment and it works out fine! Hence, this is also a solution to the question - or like the music group U2 would say: Even Better Then The Real Thing.
Thank you,
Kai
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2024 01:35 PM
07-17-2024 01:35 PM
Re: How can I find out the actual Tenant and read the Customer Number?
Hello Ollie,
hello Deepti,
Thank you for your very quick response. I will check this out and come back here to mark it as solution as early as I got it managed. I know, you already point in the right direction …
Thank you,
Kai
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2024 01:14 PM
07-17-2024 01:14 PM
Re: How can I find out the actual Tenant and read the Customer Number?
accountName, accountNumber and customerNumber, all three are available as pre-provision vars.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2024 05:44 AM
07-18-2024 05:44 AM
SolutionWhat I had in mind, was using a naming policy, and then parsing it from the spec in the config phase
For example in Python, printing the morpheus object I see there is both hostName and computedHostName with the policy implemented.
print(morpheus)
Gives me this:
{
"spec":{
"hostName":"${customerNumber}-${cloudName.toLowerCase()}-${instance.instanceContext.toLowerCase()}-${groupCode}-${type.toLowerCase()}-${sequence+100} ",
"computedHostName":"99999-vmware-1-dev-all-clouds-ubuntu-102-",
....
}
}
The aim would be to strip the customerNumber from the computed hostname and use as required.
Like, you I can’t see a way to get customerNumber, accountNumber, or accountName independently of using them in a naming policy.
I work at HPE
HPE Support Center offers support for your HPE services and products when and how you need it. Get started with HPE Support Center today.
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2024 02:55 PM
07-17-2024 02:55 PM
Re: How can I find out the actual Tenant and read the Customer Number?
Hi again,
I have managed to use the variables ${accountName} or ${customerNumber} within an Instance Naming Policy - but I cannot find a way to put the same or similar variables in a Powershell script and use it in the Configuration Phase of a Provisioning Workflow.
Since this script is a two line script like the following, can you try to get it running:
$customerName = ${accountName}
Write-Output ("Customer Name: " + $customerName)
The script like above runs without any accountName filled …
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2024 08:19 AM
07-19-2024 08:19 AM
Re: How can I find out the actual Tenant and read the Customer Number?
I agree, it would be nice as a readily available variable. How I’ve used this in PowerShell:
$morphUrl = "<%=morpheus.applianceUrl%>"
$morphToken = "<%=morpheus.apiAccessToken%>"
$morphTenant = "<%=accountId%>"
$headers=@{}
$headers.Add("accept", "application/json")
$headers.Add("authorization", "Bearer $morphToken")
#Print Customer Number
((Invoke-WebRequest -Uri "$($morphUrl)api/accounts/$morphTenant" -Method GET -Headers $headers).content | ConvertFrom-Json).account.customerNumber
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2024 06:15 AM
07-18-2024 06:15 AM
Re: How can I find out the actual Tenant and read the Customer Number?
Hi Ollie,
I see your answer as solution, since one could use this way to extract the customerNumber in a script now and move on in the same script … Thank you.
Although I am also thinking about raising an idea in the appropriate section of this forum to find any easier way to read the information of accountName, accountNumber and customerNumber from anywhere at any time, since these values are really independent of any other component like an Instance, App, Cloud, …
Thank you,
Kai