quiet-architect-74241
06/28/2021, 11:28 AMUserAssignedIdentity identity = new UserAssignedIdentity($"{name}ManagedIdentity",
new UserAssignedIdentityArgs
{
ResourceGroupName = resourceGroup.Name,
ResourceName = $"{name}ManagedIdentity",
});
new WebApp(name, new WebAppArgs
{
Kind = "app,linux",
ResourceGroupName = resourceGroup.Name,
ServerFarmId = appServicePlan.Id,
Reserved = true,
Identity = new Pulumi.AzureNative.Web.Inputs.ManagedServiceIdentityArgs
{
Type = Pulumi.AzureNative.Web.ManagedServiceIdentityType.UserAssigned,
UserAssignedIdentities =
{
{ identity.Id , "resource" }
}
},
...
My problem is in this part:
UserAssignedIdentities =
{
{ identity.Id , "resource" }
}
[Documentation](https://www.pulumi.com/docs/reference/pkg/azure-native/web/webapp/#managedserviceidentity) of userAssignedIdentities
states:
The list of user assigned identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: ‘/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}
So the key needs to be the Id of the identity you want to use.
Given that UserAssignedIdentities
is of type InputMap<object>
, which consists of a string
and an object
as a key-value pair. Now, I can't use identity.Id
since that is an Input<string>
rather than a string. And a string is expected as the first type of the collection initializer of the InputMap<object>
.
I must be missing something. How do I pass the Id of a newly created User Assigned Identity to the WebApp?billowy-army-68599
06/28/2021, 12:08 PMApply
here. I'm not a dotnet expert myself, but if a resource requires a string rather than an Input<string>
you'll need to use Apply
quiet-architect-74241
06/28/2021, 1:41 PM