powershell string change text to lowercase

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?
Kelly GarciaSenior Systems AdministratorAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

oBdACommented:
$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 AdministratorAuthor 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
oBdACommented:
Sorry, missed that.
$ServiceBusRuleId = (Get-AzureRmEventHubAuthorizationRule -ResourceGroupName "poc-eventhub" -Namespace "poc-eventhub-defra").id
$lowerServiceBusRuleId = "$($ServiceBusRuleId)" -replace '/AuthorizationRules/', '/authorizationrules/'

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Kelly GarciaSenior Systems AdministratorAuthor Commented:
thank you!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.