Hi there i have problems concerning the output. I ...
# dotnet
l
Hi there i have problems concerning the output. I create an azure api management backend
Copy code
var backend = new Backend(namePlaceHolder, new BackendArgs
{
  ApiManagementName = apiManagement.Name,
  ResourceGroupName = resourceGroup,
  Protocol = "http",
  Url = Output.Format($"https://{app.DefaultHostname}/api")
});

 Output<string> backendId = backend.Name.Apply(id => id);

        
 var backendIdParameter = Output.Format(@$"""{backendId}""");

 var apiPolicy = new ApiPolicy($"{namePlaceHolderWithoutSpecialCharacter}", new ApiPolicyArgs
 {
   ApiManagementName = apiManagement.Name,
   ResourceGroupName = resourceGroup,
   ApiName = api.Name,
   XmlContent = $@"
    <policies>
    <inbound>
     <base/>
     <set-backend-service id="4711" backend-id={backendIdParameter} />
    </inbound>
    <backend>
     <base/>
    </backend>
    <outbound>
     <base/>
    </outbound>
    <on-error>
     <base/>
    </on-error>
    </policies>",});
Every time the xmlContent is filled inside the backend-id with "Pulum.Output<string>" and not the string value. What i have to do to get the value inside this xmlContent?
t
backendIdParameter
is an output, so you can’t use it inside string formatting directly. You should use
Output.Format
to define that xml string.
👍 1
l
Ah ok thx, i will try it.
Now it works as expected. Thx.