Skip to content

Instantly share code, notes, and snippets.

@johnlokerse
Created December 4, 2022 16:43
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/aebba733521b8d387129941c68805df1 to your computer and use it in GitHub Desktop.
Save johnlokerse/aebba733521b8d387129941c68805df1 to your computer and use it in GitHub Desktop.
Deployment Scripts with Input
param parSpnName string = 'my-input-parameter'
### hidden managed identity resource ###
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'
arguments: '-SpnName ${parSpnName}'
scriptContent: '''
param (
[string] $SpnName
)
$spnAppId = New-AzADServicePrincipal -DisplayName $SpnName | 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