Skip to content

Commit 4f6a144

Browse files
authored
Merge pull request #101624 from mgreenegit/patch-12
remove section for now
2 parents e467c7f + f39d33e commit 4f6a144

File tree

1 file changed

+0
-49
lines changed

1 file changed

+0
-49
lines changed

articles/governance/policy/how-to/guest-configuration-create.md

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -232,55 +232,6 @@ You could also implement
232232
for machines in a private network, although this configuration applies only to accessing the package
233233
and not communicating with the service.
234234

235-
### Working with secrets in Guest Configuration packages
236-
237-
In Azure Policy Guest Configuration, the optimal way to manage secrets used at run time is to store
238-
them in Azure Key Vault. This design is implemented within custom DSC resources.
239-
240-
1. Create a user-assigned managed identity in Azure.
241-
242-
The identity is used by machines to access secrets stored in Key Vault. For detailed steps, see
243-
[Create, list or delete a user-assigned managed identity using Azure PowerShell](../../../active-directory/managed-identities-azure-resources/how-to-manage-ua-identity-powershell.md).
244-
245-
1. Create a Key Vault instance.
246-
247-
For detailed steps, see [Set and retrieve a secret - PowerShell](../../../key-vault/quick-create-powershell.md).
248-
Assign permissions to the instance to give the user-assigned identity access to secrets stored in
249-
Key Vault. For detailed steps, see
250-
[Set and retrieve a secret - .NET](../../../key-vault/quick-create-net.md#give-the-service-principal-access-to-your-key-vault).
251-
252-
1. Assign the user-assigned identity to your machine.
253-
254-
For detailed steps, see
255-
[Configure managed identities for Azure resources on an Azure VM using PowerShell](../../../active-directory/managed-identities-azure-resources/qs-configure-powershell-windows-vm.md#user-assigned-managed-identity).
256-
Assign this identity using Azure Resource Manager via Azure Policy at scale. For detailed steps,
257-
see
258-
[Configure managed identities for Azure resources on an Azure VM using a template](../../../active-directory/managed-identities-azure-resources/qs-configure-template-windows-vm.md#assign-a-user-assigned-managed-identity-to-an-azure-vm).
259-
260-
1. Use the client ID generated above within your custom resource to access Key Vault using the token
261-
available from the machine.
262-
263-
The `client_id` and url to the Key Vault instance can be passed to the resource as
264-
[properties](/powershell/scripting/dsc/resources/authoringresourcemof#creating-the-mof-schema) so
265-
the resource won't need to be updated for multiple environments or if the values need to be
266-
changed.
267-
268-
The following code sample can be used in a custom resource to retrieve secrets from Key Vault using
269-
a user-assigned identity. The value returned from the request to Key Vault is plain text. As a best
270-
practice, store it within a credential object.
271-
272-
```azurepowershell-interactive
273-
# the following values should be input as properties
274-
$client_id = 'e3a78c9b-4dd2-46e1-8bfa-88c0574697ce'
275-
$keyvault_url = 'https://keyvaultname.vault.azure.net/secrets/mysecret'
276-
277-
$access_token = ((Invoke-WebRequest -Uri "http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&client_id=$client_id&resource=https%3A%2F%2Fvault.azure.net" -Method GET -Headers @{Metadata='true'}).Content | ConvertFrom-Json).access_token
278-
279-
$value = ((Invoke-WebRequest -Uri $($keyvault_url+'?api-version=2016-10-01') -Method GET -Headers @{Authorization="Bearer $access_token"}).content | convertfrom-json).value | ConvertTo-SecureString -asplaintext -force
280-
281-
$credential = New-Object System.Management.Automation.PSCredential('secret',$value)
282-
```
283-
284235
## Test a Guest Configuration package
285236

286237
After creating the Configuration package but before publishing it to Azure, you can test the

0 commit comments

Comments
 (0)