Skip to content

Instantly share code, notes, and snippets.

@johnlokerse
Created December 4, 2022 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnlokerse/8b8c02d95daa6370e6f31e0677e63d41 to your computer and use it in GitHub Desktop.
Save johnlokerse/8b8c02d95daa6370e6f31e0677e63d41 to your computer and use it in GitHub Desktop.
deploymentScript
resource resDeploymentScript 'Microsoft.Resources/deploymentScripts@2020-10-01' = {
name: 'create-spn-for-kv'
location: parLocation
kind: 'AzurePowerShell'
identity: {
type: 'UserAssigned'
userAssignedIdentities: {
'${resManagedIdentity.id}' : {}
}
}
properties: {
azPowerShellVersion: '9.0'
retentionInterval: 'P1D'
scriptContent: '''
$spnAppId = New-AzADServicePrincipal -DisplayName "my-keyvault-spn" | Select-Object -ExpandProperty AppId
$DeploymentScriptOutputs = @{}
$DeploymentScriptOutputs['appId'] = $spnAppId
'''
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment