We help IT Professionals succeed at work.

powershell string change text to lowercase

Kelly Garcia
Kelly Garcia asked
on
66 Views
1 Endorsement
Last Modified: 2019-02-06
Hi All,

I have this line of code:
$ServiceBusRuleId = (Get-AzureRmEventHubAuthorizationRule -ResourceGroupName "poc-eventhub" -Namespace "poc-eventhub-defra").id 

Open in new window


this returns the following value:

$ServiceBusRuleId = /subscriptions/c7c95a-30-4ef4-bfa4-49107461/resourceps/p-eventhub/providers/Microsoft.EventHub/namespaces/p-eventhub-kay/AuthorizationRules/RootManageSharedAccessKey

Open in new window


i need it to convert the AuthorizationRules into lowercase . what is the best way to achieve this?
Comment
Watch Question

CERTIFIED EXPERT
Most Valuable Expert 2019
Most Valuable Expert 2018

Commented:
$ServiceBusRuleId = (Get-AzureRmEventHubAuthorizationRule -ResourceGroupName "poc-eventhub" -Namespace "poc-eventhub-defra").id
$lowerServiceBusRuleId = "$($ServiceBusRuleId)".ToLower()

Open in new window

The double quotes around the variable make sure it's actually a string; can't test it at the moment.
$ServiceBusRuleId.ToLower()
will work as well if the value returned is already a string.
Kelly GarciaSenior Systems Administrator

Author

Commented:
Hi,

thank you for your feedback, problem with this that it will make everything lowercase and this string is case sensitive, i only want the authorisationid to be lowercase.

Regards,
Kay
CERTIFIED EXPERT
Most Valuable Expert 2019
Most Valuable Expert 2018
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
Kelly GarciaSenior Systems Administrator

Author

Commented:
thank you!

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions