This message was deleted.
# azure
s
This message was deleted.
o
@tall-librarian-49374 any clues, please?
t
frontendIPConfiguration.Id
is never assigned in your program
I’m not sure what exactly needs to be there, but there’s nothing now, thus the error
o
thought .Id is assigned upon resource creation by pulumi?
replaced it with publicIP.Id and got this error: Code="InvalidRequestFormat" Message="Cannot parse the request." Details=[{"code":"InvalidJsonReferenceWrongType","message":"Reference Id /subscriptions/64fd453f-6026-4825-9ad7-a13a770350b8/resourceGroups/server-rg/providers/Microsoft.Network/publicIPAddresses/public-ip is referencing resource of a wrong type. The Id is expected to reference resources of type loadBalancers/frontendIPConfigurations. Path properties.inboundNatRules[0].properties.frontendIPConfiguration."
If I supply Id manually like this:
Copy code
var frontendIPConfiguration = new Pulumi.AzureNextGen.Network.Latest.Inputs.FrontendIPConfigurationArgs
        {
            Id = "PublicIPAddress",
            Name = "PublicIPAddress",
            PublicIPAddress = new Pulumi.AzureNextGen.Network.Latest.Inputs.PublicIPAddressArgs
            {
                Id = publicIp.Id,
            }
        };
then error is: error: Code="InvalidRequestFormat" Message="Cannot parse the request." Details=[{"code":"InvalidJsonReferenceFormat","message":"Reference Id PublicIPAddress is not formatted correctly. The Id is expected to reference resources of type loadBalancers/frontendIPConfigurations. Path properties.inboundNatRules[0].properties.frontendIPConfiguration."
t
thought .Id is assigned upon resource creation by pulumi?
It’s not assigned in the args, it’s assigned in the resource ouputs
Reference Id PublicIPAddress is not formatted correctly
You need to provide a real ID, not a fake ID. I’m not familiar enough with this resource to give a more specific advice.
o
@broad-dog-22463 Can you please clarify, how to properly link frontendIPConfiguration to InboundNatRule?
t
As I said, I haven’t done that. Do you have an ARM template that does so?
o
hope this helps
t
So you seem to be missing the
"id": "[concat(resourceId('Microsoft.Network/loadBalancers', parameters('loadBalancers_access_gateway_name')), '/frontendIPConfigurations/LoadBalancerFrontEnd')]"
part
o
so I should set this manually, but how to compose it properly in code? here it consists of "LBid"+"/frontendIPConfigurations/LoadBalancerFrontEnd" but I don't have LBid on that moment, it gets created later.
t
Yeah, it’s an odd design of the resource. You probably need to copy an existing ID and then make a string.Format() out of it with your parameters.
You can use resource group’s ID as the first part and then append the other parts
o
can't get rg ID like that var rg_id = _resourceGroup.Id.Apply((v) => v);
t
You may want to use
Output.Format($"{_resourceGroup.Id}/allyour/other/segments/here")
o
Made it like this:
Copy code
Id = Output.Format($"{_resourceGroup.Id}/providers/Microsoft.Network/loadBalancers/Loadbalancer/frontendIPConfigurations/LoadBalancerFrontEnd")
Still no go... error: Code="InvalidRequestFormat" Message="Cannot parse the request." Details=[{"code":"MissingJsonReferenceId","message":"Value for reference id is missing. Path properties.frontendIPConfigurations[0].properties.publicIPAddress."}]
"Loadbalancer" in the middle is the dream-name for new LB
t
This worked for me:
Copy code
var frontendIPConfiguration = new FrontendIPConfigurationArgs
        {
            Id = Output.Format($"{resourceGroup.Id}/providers/Microsoft.Network/loadBalancers/LoadBalancer/frontendIPConfigurations/LoadBalancerFrontEnd"),
            Name = "LoadBalancerFrontEnd",
            PublicIPAddress = new Pulumi.AzureNextGen.Network.Latest.Inputs.PublicIPAddressArgs
            {
                Id = publicIp.Id,
            }
        };
latest:LoadBalancer     LoadBalancer     created
o
how did you made LB itself? still fails for me...
t
Copy-pasted your code, no changes
o
doesn't work for me, sorry
Copy code
private List<Pulumi.AzureNextGen.Network.Latest.Inputs.InboundNatRuleArgs> BuildLoadBalancer()
    {
        var publicIp = new Pulumi.AzureNextGen.Network.Latest.PublicIPAddressArgs
        {
            PublicIpAddressName = "public-ip",
            Location = _resourceGroup.Location,
            ResourceGroupName = _resourceGroup.Name,
            PublicIPAllocationMethod = "Static"
        };

        var frontendIPConfiguration = new FrontendIPConfigurationArgs
        {
            Id = Output.Format($"{_resourceGroup.Id}/providers/Microsoft.Network/loadBalancers/test-lb/frontendIPConfigurations/LoadBalancerFrontEnd"),
            Name = "LoadBalancerFrontEnd",
            PublicIPAddress = new Pulumi.AzureNextGen.Network.Latest.Inputs.PublicIPAddressArgs
            {
                Id = publicIp.Id,
            }
        };

        var NatRuleArgs_dc = new Pulumi.AzureNextGen.Network.Latest.Inputs.InboundNatRuleArgs
        {
            Name = "dc_rdp",
            Protocol = "Tcp",
            FrontendPort = 33390,
            BackendPort = 3389,
            EnableTcpReset = false,
            FrontendIPConfiguration = new Pulumi.AzureNextGen.Network.Latest.Inputs.SubResourceArgs
            {
                Id = frontendIPConfiguration.Id,
            },
        };

        var NatRuleArgs_aap = new Pulumi.AzureNextGen.Network.Latest.Inputs.InboundNatRuleArgs
        {
            Name = "aap_rdp",
            Protocol = "Tcp",
            FrontendPort = 33391,
            BackendPort = 3389,
            EnableTcpReset = false,
            FrontendIPConfiguration = new Pulumi.AzureNextGen.Network.Latest.Inputs.SubResourceArgs
            {
                Id = frontendIPConfiguration.Id,
            },
        };

        var NatRuleArgs_vui = new Pulumi.AzureNextGen.Network.Latest.Inputs.InboundNatRuleArgs
        {
            Name = "vui_rdp",
            Protocol = "Tcp",
            FrontendPort = 33392,
            BackendPort = 3389,
            EnableTcpReset = false,
            FrontendIPConfiguration = new Pulumi.AzureNextGen.Network.Latest.Inputs.SubResourceArgs
            {
                Id = frontendIPConfiguration.Id,
            },
        };

        var NatRulesArgs = new List<Pulumi.AzureNextGen.Network.Latest.Inputs.InboundNatRuleArgs> { NatRuleArgs_dc, NatRuleArgs_aap, NatRuleArgs_vui };

        var loadBalancer = new LoadBalancer("test-lb", new LoadBalancerArgs
        {
            LoadBalancerName = "test-lb",
            ResourceGroupName = _resourceGroup.Name,
            Location = _resourceGroup.Location,
            FrontendIPConfigurations = frontendIPConfiguration,
            InboundNatRules = NatRulesArgs,
        });

        return NatRulesArgs;
    }
t
Are you on version 0.2.1 (or 0.2.0)?
o
0.2.1, updated yesterday
t
My public IP is a real resource, not args:
Copy code
var publicIp = new PublicIPAddress("public-ip", new Pulumi.AzureNextGen.Network.Latest.PublicIPAddressArgs
{
    PublicIpAddressName = "public-ip",
    Location = resourceGroup.Location,
    ResourceGroupName = resourceGroup.Name,
    PublicIPAllocationMethod = "Static"
});
For the rest your code works.
o
hm, that took me further, but still 🙂 error: Running program 'D:\Pulumi\azure-cs-webserver\bin\Debug\netcoreapp3.1\Azure.WebServer.dll' failed with an unhandled exception: System.InvalidOperationException: This operation cannot be performed on a default instance of ImmutableArray<T>. Consider initializing the array, or checking the ImmutableArray<T>.IsDefault property. at System.Collections.Immutable.ImmutableArray`1.ThrowInvalidOperationIfNotInitialized() at System.Collections.Immutable.ImmutableArray`1.System.Collections.ICollection.get_Count() at Pulumi.Serialization.Serializer.SerializeListAsync(String ctx, IList list) at Pulumi.Serialization.Serializer.SerializeAsync(String ctx, Object prop) at Pulumi.Serialization.Serializer.SerializeAsync(String ctx, Object prop) at Pulumi.Serialization.Serializer.SerializeAsync(String ctx, Object prop) at Pulumi.Serialization.Serializer.SerializeDictionaryAsync(String ctx, IDictionary dictionary) at Pulumi.Serialization.Serializer.SerializeInputArgsAsync(String ctx, InputArgs args) at Pulumi.Serialization.Serializer.SerializeAsync(String ctx, Object prop) at Pulumi.Serialization.Serializer.SerializeAsync(String ctx, Object prop) at Pulumi.Serialization.Serializer.SerializeAsync(String ctx, Object prop) at Pulumi.Serialization.Serializer.SerializeDictionaryAsync(String ctx, IDictionary dictionary) at Pulumi.Serialization.Serializer.SerializeInputArgsAsync(String ctx, InputArgs args) at Pulumi.Serialization.Serializer.SerializeAsync(String ctx, Object prop) at Pulumi.Serialization.Serializer.SerializeListAsync(String ctx, IList list) at Pulumi.Serialization.Serializer.SerializeAsync(String ctx, Object prop) at Pulumi.Serialization.Serializer.SerializeAsync(String ctx, Object prop) at Pulumi.Serialization.Serializer.SerializeAsync(String ctx, Object prop) at Pulumi.Deployment.SerializeFilteredPropertiesAsync(String label, IDictionary`2 args, Predicate`1 acceptKey) at Pulumi.Deployment.PrepareResourceAsync(String label, Resource res, Boolean custom, ResourceArgs args, ResourceOptions options) at Pulumi.Deployment.RegisterResourceAsync(Resource resource, ResourceArgs args, ResourceOptions options) at Pulumi.Deployment.ReadOrRegisterResourceAsync(Resource resource, ResourceArgs args, ResourceOptions options) at Pulumi.Deployment.CompleteResourceAsync(Resource resource, ResourceArgs args, ResourceOptions options, ImmutableDictionary`2 completionSources) at Pulumi.Output`1.Pulumi.IOutput.GetDataAsync() at Pulumi.Serialization.Serializer.SerializeAsync(String ctx, Object prop) at Pulumi.Serialization.Serializer.SerializeAsync(String ctx, Object prop) at Pulumi.Serialization.Serializer.SerializeDictionaryAsync(String ctx, IDictionary dictionary) at Pulumi.Serialization.Serializer.SerializeInputArgsAsync(String ctx, InputArgs args) at Pulumi.Serialization.Serializer.SerializeAsync(String ctx, Object prop) at Pulumi.Serialization.Serializer.SerializeListAsync(String ctx, IList list) at Pulumi.Serialization.Serializer.SerializeAsync(String ctx, Object prop) at Pulumi.Serialization.Serializer.SerializeAsync(String ctx, Object prop) at Pulumi.Serialization.Serializer.SerializeAsync(String ctx, Object prop) at Pulumi.Serialization.Serializer.SerializeDictionaryAsync(String ctx, IDictionary dictionary) at Pulumi.Serialization.Serializer.SerializeInputArgsAsync(String ctx, InputArgs args) at Pulumi.Serialization.Serializer.SerializeAsync(String ctx, Object prop) at Pulumi.Serialization.Serializer.SerializeAsync(String ctx, Object prop) at Pulumi.Serialization.Serializer.SerializeAsync(String ctx, Object prop) at Pulumi.Deployment.SerializeFilteredPropertiesAsync(String label, IDictionary`2 args, Predicate`1 acceptKey) at Pulumi.Deployment.PrepareResourceAsync(String label, Resource res, Boolean custom, ResourceArgs args, ResourceOptions options) at Pulumi.Deployment.RegisterResourceAsync(Resource resource, ResourceArgs args, ResourceOptions options) at Pulumi.Deployment.ReadOrRegisterResourceAsync(Resource resource, ResourceArgs args, ResourceOptions options) at Pulumi.Deployment.CompleteResourceAsync(Resource resource, ResourceArgs args, ResourceOptions options, ImmutableDictionary`2 completionSources) at Pulumi.Deployment.Runner.<>c__DisplayClass7_0.<<WhileRunningAsync>g__HandleCompletion|0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Pulumi.Deployment.Runner.WhileRunningAsync()
perhaps issue is other part than LB 🙂
LB was created!
t
That’s great!