I have a loadbalancer I am trying to configure via the REST api.
if I manually create an inbound rule in the azure UI I can then query that rule in the REST API and clearly see my backend IP configuration:
Inbound rule object created manually in the azure panel:
{
'name': 'forward8005to3389manual',
'id': '/subscriptions/xxx/resourceGroups/yyy/providers/Microsoft.Network/loadBalancers/zzz_LoadBalancer/inboundNatRules/forward8005to3389manual',
'etag': '......',
'type': 'Microsoft.Network/loadBalancers/inboundNatRules',
'properties': {
'provisioningState': 'Succeeded',
'frontendIPConfiguration': {
'id': '/subscriptions/xxx/resourceGroups/yyy/providers/Microsoft.Network/loadBalancers/zzz_LoadBalancer/frontendIPConfigurations/FrontEndIPConfig',
},
'frontendPort': 8005,
'backendPort': 3389,
'enableFloatingIP': false,
'idleTimeoutInMinutes': 4,
'protocol': 'Tcp',
'enableDestinationServiceEndpoint': false,
'enableTcpReset': true,
'allowBackendPortConflict': false,
'backendIPConfiguration': {
'id' => '/subscriptions/xxx/resourceGroups/aaaaaaa/providers/Microsoft.Network/networkInterfaces/bbbb/ipConfigurations/ccccc',
}
}
}
But when I create a rule using the REST API
using this endpoint resourceGroups/xxx/providers/Microsoft.Network/loadBalancers/zzz_LoadBalancer/inboundNatRules/forward8005to3389api?api-version=2023-06-01
here is my payload:
$options = [
'name' => $ruleName,
'properties' => [
'frontendIPConfiguration' => [
'id' => '/subscriptions/xxx/resourceGroups/yyy/providers/Microsoft.Network/loadBalancers/zzz_LoadBalancer/frontendIPConfigurations/frontendIpConfig',
],
'protocol' => 'Tcp',
'frontendPort' => '8105',
'backendPort' => 3389,
'enableFloatingIP' => false,
'idleTimeoutInMinutes' => 4,
'enableTcpReset' => true,
'backendIPConfiguration' => [
'id' => '/subscriptions/xxx/resourceGroups/aaa/providers/Microsoft.Network/networkInterfaces/bbb-nic/ipConfigurations/bbb-ipconfig',
],
],
];
I have confirmed all the relevant ids are correct (subscription, front end ip config, back end nic, and ip conifg, resourcegroups, etc.
The rule is successfully created BUT WITHOUT THE BACKEND IP CONFIG - So obviously it does not route properly. If i Query it again, I get no backend IP config listed
{
'name': 'forward8005to3389api',
'id': '/subscriptions/xxx/resourceGroups/yyy/providers/Microsoft.Network/loadBalancers/zzz_LoadBalancer/inboundNatRules/forward8005to3389api',
'etag': '......',
'type': 'Microsoft.Network/loadBalancers/inboundNatRules',
'properties': {
'provisioningState': 'Succeeded',
'frontendIPConfiguration': {
'id': '/subscriptions/xxx/resourceGroups/yyy/providers/Microsoft.Network/loadBalancers/zzz_LoadBalancer/frontendIPConfigurations/FrontEndIPConfig',
},
'frontendPort': 8005,
'backendPort': 3389,
'enableFloatingIP': false,
'idleTimeoutInMinutes': 4,
'protocol': 'Tcp',
'enableDestinationServiceEndpoint': false,
'enableTcpReset': true,
'allowBackendPortConflict': false,
}
I have no idea where to turn - I dont even see the backendIPConfiguration in the end point docs: [https://learn.microsoft.com/en-us/rest/api/load-balancer/inbound-nat-rules/create-or-update?view=rest-load-balancer-2023-06-01&tabs=HTTP](API Reference)
There is a backendAddressPool
but I need just a specific Machine or IP to be specified.
(My goal port forward all requests to port 8005 to machine05 on ip address 10.0.0.105) But these machines are ephemeral and generated dynamically so I need to be able to create the proper rules when the machine exists...
Thanks anyone!!
tried adding backendIPConfiguration
to properties
Expecting the rule to keep this property
but property discarded, no error - status code 200, rule created but useless rule because it is missing a target machine and backendIPaddress