mirror of
				https://github.com/bartvdbraak/keyweave.git
				synced 2025-10-31 00:19:11 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			33 lines
		
	
	
	
		
			945 B
		
	
	
	
		
			Bicep
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
	
		
			945 B
		
	
	
	
		
			Bicep
		
	
	
	
	
	
| param nameFormat string
 | |
| param location string
 | |
| param tags object
 | |
| 
 | |
| param identityEnvironments array = [
 | |
|   'none'
 | |
|   'get'
 | |
|   'list'
 | |
|   'getlist'
 | |
| ]
 | |
| 
 | |
| resource managedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = [for (environment, index) in identityEnvironments: {
 | |
|   name: format(nameFormat, 'ID', index+1)
 | |
|   location: location
 | |
|   tags: tags
 | |
| }]
 | |
| 
 | |
| resource federatedCredential 'Microsoft.ManagedIdentity/userAssignedIdentities/federatedIdentityCredentials@2023-01-31' = [for (environment, index) in identityEnvironments: {
 | |
|   name: environment
 | |
|   parent: managedIdentity[index]
 | |
|   properties: {
 | |
|     issuer: 'https://token.actions.githubusercontent.com'
 | |
|     subject: 'repo:bartvdbraak/keyweave:environment:test'
 | |
|     audiences: [
 | |
|       'api://AzureADTokenExchange'
 | |
|     ]
 | |
|   }
 | |
| }]
 | |
| 
 | |
| output identities array = [for (environment, index) in identityEnvironments: {
 | |
|   name: environment
 | |
|   id: managedIdentity[index].properties.principalId
 | |
| }]
 |