azure:service_principles

Service Principles

I used the following Powershell commands to setup a session using a service principle. I also had to give the SP the Reader role over the scope over the subscription.

$appId = "xxxx"
$clientSecret = $env:appsecret
$securePassword = ConvertTo-SecureString -String $clientSecret -AsPlainText -Force
$tenantId = "xxxx"
$subscriptionId = "xxxx"
$credential = New-Object -TypeName System.Management.Automation.PSCredential $appId, $securePassword
Connect-AzAccount -ServicePrincipal -TenantId $tenantId -SubscriptionId $subscriptionId -Credential $credential
  • azure/service_principles.txt
  • Last modified: 2024/11/05 20:55
  • by mmuze