Hey guys, has anyone here successfully passed an A...
# general
Hey guys, has anyone here successfully passed an Azure
into a
before in TS? I am having a lot of trouble. The example I have here, shows I can add a UAI to a webapp when I hardcode the id as the property, with a value of
as stated by the documentation here: https://www.pulumi.com/registry/packages/azure-native/api-docs/web/webapp/#managedserviceidentity _(I found that even the docs mentions that the second property should be
but that doesnt work even with hardcoding, so ive fallen back to the ARM template output from a pre-created resource which seems to work)_ The entire string looks like this:
Copy code
let identity: any = {
            type: "UserAssigned",
            userAssignedIdentities: {
                "/subscriptions/<sub-id>/resourcegroups/<rg>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/<uai-name>" : {}
However, I cannot get the actual UAI id into the identity object due to the property of
not accepting an
as a property type. Using
[UAI]: {}
to try cast the identity does not work either as it tries to cast it to a string. How does everyone else do it?
How do you match the types up when you cannot have
as a property of a Map?
The value can't be an Output but the whole map can be so you can use apply to move the outputness up a level, something like:
Copy code
let out = <some output value>
let map = out.apply(value => { "key": value })
I've got an example of how to do this (specifically with a managed k8s cluster, but you can use it elsewhere): https://github.com/pulumi/pulumi-azure-native/issues/812#issuecomment-1009779637
@brave-planet-10645 thanks for that, worked like a charm
endedup wrapping it so I can use it for a deployment slot also:
Copy code
const getId = (id: string) => {
      const dict: {[key: string]: object} = {};
      dict[id] = {};
      return dict; 

let identity: any = {
   type: "userAssigned",
   userAssignedIdentities: args.userAssignedIdentity.id.apply(id => getId(id))