Link to home
Create AccountLog in
Avatar of Kelly Garcia
Kelly GarciaFlag for United Kingdom of Great Britain and Northern Ireland

asked on

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?
Avatar of oBdA
oBdA

$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.
Avatar of Kelly Garcia

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
thank you!