Skip to content

Instantly share code, notes, and snippets.

@Agazoth
Last active October 8, 2025 13:38
Show Gist options
  • Select an option

  • Save Agazoth/6a0c8555034a883bdc18f69477a29130 to your computer and use it in GitHub Desktop.

Select an option

Save Agazoth/6a0c8555034a883bdc18f69477a29130 to your computer and use it in GitHub Desktop.
CSPSelfService
{
"$schema": "https://schema.management.azure.com/schemas/2019-08-01/deploymentTemplate.json#",
"languageVersion": "2.0",
"contentVersion": "1.0.0.0",
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.38.33.27573",
"templateHash": "18130798728223464240"
}
},
"parameters": {
"appDisplayName": {
"type": "string",
"defaultValue": "Atea CSP SelfService App",
"metadata": {
"description": "The display name for the app registration"
}
},
"DisplayName": {
"type": "string",
"defaultValue": "CSP SelfService App Secret",
"metadata": {
"description": "The password credential display name"
}
},
"DurationYears": {
"type": "int",
"defaultValue": 10,
"metadata": {
"description": "The password credential duration in years"
}
},
"StartDate": {
"type": "string",
"defaultValue": "[utcNow('u')]",
"metadata": {
"description": "The start date for the password credential"
}
}
},
"variables": {
"passwordEndDate": "[dateTimeAdd(parameters('StartDate'), format('P{0}Y', parameters('DurationYears')))]",
"apiAppId": "96d7123f-7ff2-4e76-8878-b5f31bfdec7c",
"delegatedPermissionId": "user_impersonation"
},
"imports": {
"MicrosoftGraph": {
"provider": "MicrosoftGraph",
"version": "0.1.8-preview"
}
},
"resources": {
"appReg": {
"import": "MicrosoftGraph",
"type": "Microsoft.Graph/[email protected]",
"properties": {
"displayName": "[parameters('appDisplayName')]",
"uniqueName": "[replace(parameters('appDisplayName'), ' ', '')]",
"requiredResourceAccess": [
{
"resourceAppId": "[variables('apiAppId')]",
"resourceAccess": [
{
"id": "[reference('servicePrincipal').oauth2PermissionScopes[0].id]",
"type": "Scope"
}
]
}
],
"passwordCredentials": [
{
"displayName": "[parameters('DisplayName')]",
"startDateTime": "[parameters('StartDate')]",
"endDateTime": "[variables('passwordEndDate')]"
}
]
},
"dependsOn": [
"servicePrincipal"
]
},
"servicePrincipal": {
"import": "MicrosoftGraph",
"type": "Microsoft.Graph/[email protected]",
"properties": {
"appId": "[variables('apiAppId')]"
}
}
},
"outputs": {
"servicePrincipalId": {
"type": "string",
"value": "[reference('servicePrincipal').id]"
},
"applicationid": {
"type": "string",
"value": "[reference('appReg').appId]"
},
"secret": {
"type": "string",
"value": "[reference('appReg').passwordCredentials[0].secretText]"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment