ロード バランサーを作成または更新します。
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}?api-version=2024-05-01
URI パラメーター
名前 |
/ |
必須 |
型 |
説明 |
loadBalancerName
|
path |
True
|
string
|
ロード バランサーの名前。
|
resourceGroupName
|
path |
True
|
string
|
リソース グループの名前。
|
subscriptionId
|
path |
True
|
string
|
Microsoft Azure サブスクリプションを一意に識別するサブスクリプション資格情報。 サブスクリプション ID は、すべてのサービス呼び出しの URI の一部を形成します。
|
api-version
|
query |
True
|
string
|
クライアント API のバージョン。
|
要求本文
名前 |
型 |
説明 |
extendedLocation
|
ExtendedLocation
|
ロード バランサーの拡張された場所。
|
id
|
string
|
リソース ID。
|
location
|
string
|
リソースの場所。
|
properties.backendAddressPools
|
BackendAddressPool[]
|
ロード バランサーによって使用されるバックエンド アドレス プールのコレクション。
|
properties.frontendIPConfigurations
|
FrontendIPConfiguration[]
|
ロード バランサーに使用するフロントエンド IP を表すオブジェクト。
|
properties.inboundNatPools
|
InboundNatPool[]
|
ロード バランサーに関連付けられている NIC 上の単一のバックエンド ポートへの受信 NAT の外部ポート範囲を定義します。 受信 NAT 規則は、ロード バランサーに関連付けられている NIC ごとに、この範囲の外部ポートを使用して自動的に作成されます。 ロード バランサーで受信 NAT プールを定義することは、受信 NAT 規則の定義と相互に排他的です。 受信 NAT プールは、仮想マシン スケール セットから参照されます。 個々の仮想マシンに関連付けられている NIC は、受信 NAT プールを参照できません。 個々の受信 NAT 規則を参照する必要があります。
|
properties.inboundNatRules
|
InboundNatRule[]
|
ロード バランサーによって使用される受信 NAT 規則のコレクション。 ロード バランサーでの受信 NAT 規則の定義は、受信 NAT プールの定義と相互に排他的です。 受信 NAT プールは、仮想マシン スケール セットから参照されます。 個々の仮想マシンに関連付けられている NIC は、受信 NAT プールを参照できません。 個々の受信 NAT 規則を参照する必要があります。
|
properties.loadBalancingRules
|
LoadBalancingRule[]
|
負荷分散規則を表すオブジェクト コレクション プロビジョニングを取得します。
|
properties.outboundRules
|
OutboundRule[]
|
送信規則。
|
properties.probes
|
Probe[]
|
ロード バランサーで使用されるプローブ オブジェクトのコレクション。
|
sku
|
LoadBalancerSku
|
ロード バランサー SKU。
|
tags
|
object
|
リソース タグ。
|
応答
名前 |
型 |
説明 |
200 OK
|
LoadBalancer
|
更新が成功しました。 この操作は、結果の LoadBalancer リソースを返します。
|
201 Created
|
LoadBalancer
|
正常に作成されます。 この操作は、結果の LoadBalancer リソースを返します。
|
Other Status Codes
|
CloudError
|
操作が失敗した理由を説明するエラー応答。
|
セキュリティ
azure_auth
Azure Active Directory OAuth2 フロー。
型:
oauth2
フロー:
implicit
Authorization URL (承認 URL):
https://login.microsoftonline.com/common/oauth2/authorize
スコープ
名前 |
説明 |
user_impersonation
|
ユーザー アカウントを偽装する
|
例
Create load balancer
要求のサンプル
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb?api-version=2024-05-01
{
"location": "eastus",
"properties": {
"frontendIPConfigurations": [
{
"name": "fe-lb",
"properties": {
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"
}
}
}
],
"backendAddressPools": [
{
"name": "be-lb",
"properties": {}
}
],
"loadBalancingRules": [
{
"name": "rulelb",
"properties": {
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 80,
"backendPort": 80,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp",
"enableTcpReset": false,
"loadDistribution": "Default",
"backendAddressPool": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"
},
"probe": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"
}
}
}
],
"probes": [
{
"name": "probe-lb",
"properties": {
"protocol": "Http",
"port": 80,
"requestPath": "healthcheck.aspx",
"intervalInSeconds": 15,
"numberOfProbes": 2,
"probeThreshold": 1
}
}
],
"inboundNatRules": [
{
"name": "in-nat-rule",
"properties": {
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 3389,
"backendPort": 3389,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp",
"enableTcpReset": false
}
}
],
"inboundNatPools": []
}
}
import com.azure.core.management.SubResource;
import com.azure.resourcemanager.network.fluent.models.BackendAddressPoolInner;
import com.azure.resourcemanager.network.fluent.models.FrontendIpConfigurationInner;
import com.azure.resourcemanager.network.fluent.models.InboundNatRuleInner;
import com.azure.resourcemanager.network.fluent.models.LoadBalancerInner;
import com.azure.resourcemanager.network.fluent.models.LoadBalancingRuleInner;
import com.azure.resourcemanager.network.fluent.models.ProbeInner;
import com.azure.resourcemanager.network.fluent.models.SubnetInner;
import com.azure.resourcemanager.network.models.LoadDistribution;
import com.azure.resourcemanager.network.models.ProbeProtocol;
import com.azure.resourcemanager.network.models.TransportProtocol;
import java.util.Arrays;
/**
* Samples for LoadBalancers CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreate.json
*/
/**
* Sample code: Create load balancer.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createLoadBalancer(com.azure.resourcemanager.AzureResourceManager azure) {
azure.networks().manager().serviceClient().getLoadBalancers().createOrUpdate("rg1", "lb",
new LoadBalancerInner().withLocation("eastus").withFrontendIpConfigurations(
Arrays.asList(new FrontendIpConfigurationInner().withName("fe-lb").withSubnet(new SubnetInner().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"))))
.withBackendAddressPools(Arrays.asList(new BackendAddressPoolInner().withName("be-lb")))
.withLoadBalancingRules(Arrays.asList(new LoadBalancingRuleInner().withName("rulelb")
.withFrontendIpConfiguration(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"))
.withBackendAddressPool(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"))
.withProbe(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"))
.withProtocol(TransportProtocol.TCP).withLoadDistribution(LoadDistribution.DEFAULT)
.withFrontendPort(80).withBackendPort(80).withIdleTimeoutInMinutes(15).withEnableFloatingIp(true)
.withEnableTcpReset(false)))
.withProbes(Arrays.asList(new ProbeInner().withName("probe-lb").withProtocol(ProbeProtocol.HTTP)
.withPort(80).withIntervalInSeconds(15).withNumberOfProbes(2).withProbeThreshold(1)
.withRequestPath("healthcheck.aspx")))
.withInboundNatRules(Arrays.asList(new InboundNatRuleInner().withName("in-nat-rule")
.withFrontendIpConfiguration(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"))
.withProtocol(TransportProtocol.TCP).withFrontendPort(3389).withBackendPort(3389)
.withIdleTimeoutInMinutes(15).withEnableFloatingIp(true).withEnableTcpReset(false)))
.withInboundNatPools(Arrays.asList()),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.network import NetworkManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-network
# USAGE
python load_balancer_create.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = NetworkManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.load_balancers.begin_create_or_update(
resource_group_name="rg1",
load_balancer_name="lb",
parameters={
"location": "eastus",
"properties": {
"backendAddressPools": [{"name": "be-lb", "properties": {}}],
"frontendIPConfigurations": [
{
"name": "fe-lb",
"properties": {
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"
}
},
}
],
"inboundNatPools": [],
"inboundNatRules": [
{
"name": "in-nat-rule",
"properties": {
"backendPort": 3389,
"enableFloatingIP": True,
"enableTcpReset": False,
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 3389,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp",
},
}
],
"loadBalancingRules": [
{
"name": "rulelb",
"properties": {
"backendAddressPool": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"
},
"backendPort": 80,
"enableFloatingIP": True,
"enableTcpReset": False,
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 80,
"idleTimeoutInMinutes": 15,
"loadDistribution": "Default",
"probe": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"
},
"protocol": "Tcp",
},
}
],
"probes": [
{
"name": "probe-lb",
"properties": {
"intervalInSeconds": 15,
"numberOfProbes": 2,
"port": 80,
"probeThreshold": 1,
"protocol": "Http",
"requestPath": "healthcheck.aspx",
},
}
],
},
},
).result()
print(response)
# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreate.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armnetwork_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ab04533261eff228f28e08900445d0edef3eb70c/specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreate.json
func ExampleLoadBalancersClient_BeginCreateOrUpdate_createLoadBalancer() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armnetwork.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewLoadBalancersClient().BeginCreateOrUpdate(ctx, "rg1", "lb", armnetwork.LoadBalancer{
Location: to.Ptr("eastus"),
Properties: &armnetwork.LoadBalancerPropertiesFormat{
BackendAddressPools: []*armnetwork.BackendAddressPool{
{
Name: to.Ptr("be-lb"),
Properties: &armnetwork.BackendAddressPoolPropertiesFormat{},
}},
FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{
{
Name: to.Ptr("fe-lb"),
Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{
Subnet: &armnetwork.Subnet{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"),
},
},
}},
InboundNatPools: []*armnetwork.InboundNatPool{},
InboundNatRules: []*armnetwork.InboundNatRule{
{
Name: to.Ptr("in-nat-rule"),
Properties: &armnetwork.InboundNatRulePropertiesFormat{
BackendPort: to.Ptr[int32](3389),
EnableFloatingIP: to.Ptr(true),
EnableTCPReset: to.Ptr(false),
FrontendIPConfiguration: &armnetwork.SubResource{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
},
FrontendPort: to.Ptr[int32](3389),
IdleTimeoutInMinutes: to.Ptr[int32](15),
Protocol: to.Ptr(armnetwork.TransportProtocolTCP),
},
}},
LoadBalancingRules: []*armnetwork.LoadBalancingRule{
{
Name: to.Ptr("rulelb"),
Properties: &armnetwork.LoadBalancingRulePropertiesFormat{
BackendAddressPool: &armnetwork.SubResource{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"),
},
BackendPort: to.Ptr[int32](80),
EnableFloatingIP: to.Ptr(true),
EnableTCPReset: to.Ptr(false),
FrontendIPConfiguration: &armnetwork.SubResource{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
},
FrontendPort: to.Ptr[int32](80),
IdleTimeoutInMinutes: to.Ptr[int32](15),
LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault),
Probe: &armnetwork.SubResource{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"),
},
Protocol: to.Ptr(armnetwork.TransportProtocolTCP),
},
}},
Probes: []*armnetwork.Probe{
{
Name: to.Ptr("probe-lb"),
Properties: &armnetwork.ProbePropertiesFormat{
IntervalInSeconds: to.Ptr[int32](15),
NumberOfProbes: to.Ptr[int32](2),
Port: to.Ptr[int32](80),
ProbeThreshold: to.Ptr[int32](1),
RequestPath: to.Ptr("healthcheck.aspx"),
Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP),
},
}},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.LoadBalancer = armnetwork.LoadBalancer{
// Name: to.Ptr("lb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb"),
// Location: to.Ptr("eastus"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.LoadBalancerPropertiesFormat{
// BackendAddressPools: []*armnetwork.BackendAddressPool{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"),
// Name: to.Ptr("be-lb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/backendAddressPools"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.BackendAddressPoolPropertiesFormat{
// LoadBalancingRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"),
// }},
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// },
// }},
// FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
// Name: to.Ptr("fe-lb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/frontendIPConfigurations"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{
// InboundNatRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"),
// }},
// LoadBalancingRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"),
// }},
// PrivateIPAddress: to.Ptr("10.0.1.4"),
// PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic),
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// Subnet: &armnetwork.Subnet{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"),
// },
// },
// }},
// InboundNatPools: []*armnetwork.InboundNatPool{
// },
// InboundNatRules: []*armnetwork.InboundNatRule{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"),
// Name: to.Ptr("in-nat-rule"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/inboundNatRules"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.InboundNatRulePropertiesFormat{
// BackendPort: to.Ptr[int32](3389),
// EnableFloatingIP: to.Ptr(true),
// EnableTCPReset: to.Ptr(false),
// FrontendIPConfiguration: &armnetwork.SubResource{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
// },
// FrontendPort: to.Ptr[int32](3389),
// IdleTimeoutInMinutes: to.Ptr[int32](15),
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// Protocol: to.Ptr(armnetwork.TransportProtocolTCP),
// },
// }},
// LoadBalancingRules: []*armnetwork.LoadBalancingRule{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"),
// Name: to.Ptr("rulelb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/loadBalancingRules"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.LoadBalancingRulePropertiesFormat{
// BackendAddressPool: &armnetwork.SubResource{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"),
// },
// BackendPort: to.Ptr[int32](80),
// DisableOutboundSnat: to.Ptr(false),
// EnableFloatingIP: to.Ptr(true),
// EnableTCPReset: to.Ptr(false),
// FrontendIPConfiguration: &armnetwork.SubResource{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
// },
// FrontendPort: to.Ptr[int32](80),
// IdleTimeoutInMinutes: to.Ptr[int32](15),
// LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault),
// Probe: &armnetwork.SubResource{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"),
// },
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// Protocol: to.Ptr(armnetwork.TransportProtocolTCP),
// },
// }},
// Probes: []*armnetwork.Probe{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"),
// Name: to.Ptr("probe-lb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/probes"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.ProbePropertiesFormat{
// IntervalInSeconds: to.Ptr[int32](15),
// LoadBalancingRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"),
// }},
// NumberOfProbes: to.Ptr[int32](2),
// Port: to.Ptr[int32](80),
// ProbeThreshold: to.Ptr[int32](1),
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// RequestPath: to.Ptr("healthcheck.aspx"),
// Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP),
// },
// }},
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"),
// },
// SKU: &armnetwork.LoadBalancerSKU{
// Name: to.Ptr(armnetwork.LoadBalancerSKUNameBasic),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { NetworkManagementClient } = require("@azure/arm-network");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates a load balancer.
*
* @summary Creates or updates a load balancer.
* x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreate.json
*/
async function createLoadBalancer() {
const subscriptionId = process.env["NETWORK_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["NETWORK_RESOURCE_GROUP"] || "rg1";
const loadBalancerName = "lb";
const parameters = {
backendAddressPools: [{ name: "be-lb" }],
frontendIPConfigurations: [
{
name: "fe-lb",
subnet: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb",
},
},
],
inboundNatPools: [],
inboundNatRules: [
{
name: "in-nat-rule",
backendPort: 3389,
enableFloatingIP: true,
enableTcpReset: false,
frontendIPConfiguration: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb",
},
frontendPort: 3389,
idleTimeoutInMinutes: 15,
protocol: "Tcp",
},
],
loadBalancingRules: [
{
name: "rulelb",
backendAddressPool: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb",
},
backendPort: 80,
enableFloatingIP: true,
enableTcpReset: false,
frontendIPConfiguration: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb",
},
frontendPort: 80,
idleTimeoutInMinutes: 15,
loadDistribution: "Default",
probe: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb",
},
protocol: "Tcp",
},
],
location: "eastus",
probes: [
{
name: "probe-lb",
intervalInSeconds: 15,
numberOfProbes: 2,
port: 80,
probeThreshold: 1,
requestPath: "healthcheck.aspx",
protocol: "Http",
},
],
};
const credential = new DefaultAzureCredential();
const client = new NetworkManagementClient(credential, subscriptionId);
const result = await client.loadBalancers.beginCreateOrUpdateAndWait(
resourceGroupName,
loadBalancerName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Network.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Resources.Models;
using Azure.ResourceManager.Network;
// Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreate.json
// this example is just showing the usage of "LoadBalancers_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this LoadBalancerResource
LoadBalancerCollection collection = resourceGroupResource.GetLoadBalancers();
// invoke the operation
string loadBalancerName = "lb";
LoadBalancerData data = new LoadBalancerData
{
FrontendIPConfigurations = {new FrontendIPConfigurationData
{
Subnet = new SubnetData
{
Id = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"),
},
Name = "fe-lb",
}},
BackendAddressPools = {new BackendAddressPoolData
{
Name = "be-lb",
}},
LoadBalancingRules = {new LoadBalancingRuleData
{
Properties = new LoadBalancingRuleProperties(LoadBalancingTransportProtocol.Tcp, 80)
{
FrontendIPConfigurationId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
BackendAddressPoolId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"),
ProbeId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"),
LoadDistribution = LoadDistribution.Default,
BackendPort = 80,
IdleTimeoutInMinutes = 15,
EnableFloatingIP = true,
EnableTcpReset = false,
},
Name = "rulelb",
}},
Probes = {new ProbeData
{
Protocol = ProbeProtocol.Http,
Port = 80,
IntervalInSeconds = 15,
NumberOfProbes = 2,
ProbeThreshold = 1,
RequestPath = "healthcheck.aspx",
Name = "probe-lb",
}},
InboundNatRules = {new InboundNatRuleData
{
FrontendIPConfigurationId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
Protocol = LoadBalancingTransportProtocol.Tcp,
FrontendPort = 3389,
BackendPort = 3389,
IdleTimeoutInMinutes = 15,
EnableFloatingIP = true,
EnableTcpReset = false,
Name = "in-nat-rule",
}},
InboundNatPools = { },
Location = new AzureLocation("eastus"),
};
ArmOperation<LoadBalancerResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, loadBalancerName, data);
LoadBalancerResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
LoadBalancerData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"name": "lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb",
"type": "Microsoft.Network/loadBalancers",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"location": "eastus",
"sku": {
"name": "Basic"
},
"properties": {
"provisioningState": "Succeeded",
"resourceGuid": "00000000-0000-0000-0000-00000000",
"frontendIPConfigurations": [
{
"name": "fe-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb",
"type": "Microsoft.Network/loadBalancers/frontendIPConfigurations",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"privateIPAddress": "10.0.1.4",
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"
},
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
],
"inboundNatRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"
}
]
}
}
],
"backendAddressPools": [
{
"name": "be-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb",
"type": "Microsoft.Network/loadBalancers/backendAddressPools",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
}
],
"loadBalancingRules": [
{
"name": "rulelb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb",
"type": "Microsoft.Network/loadBalancers/loadBalancingRules",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 80,
"backendPort": 80,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp",
"enableTcpReset": false,
"loadDistribution": "Default",
"backendAddressPool": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"
},
"probe": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"
},
"disableOutboundSnat": false
}
}
],
"probes": [
{
"name": "probe-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb",
"type": "Microsoft.Network/loadBalancers/probes",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"protocol": "Http",
"port": 80,
"requestPath": "healthcheck.aspx",
"intervalInSeconds": 15,
"numberOfProbes": 2,
"probeThreshold": 1,
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
}
],
"inboundNatRules": [
{
"name": "in-nat-rule",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule",
"type": "Microsoft.Network/loadBalancers/inboundNatRules",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 3389,
"backendPort": 3389,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp",
"enableTcpReset": false
}
}
],
"inboundNatPools": []
}
}
{
"name": "lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb",
"type": "Microsoft.Network/loadBalancers",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"location": "eastus",
"sku": {
"name": "Basic"
},
"properties": {
"provisioningState": "Succeeded",
"resourceGuid": "00000000-0000-0000-0000-00000000",
"frontendIPConfigurations": [
{
"name": "fe-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb",
"type": "Microsoft.Network/loadBalancers/frontendIPConfigurations",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"privateIPAddress": "10.0.1.4",
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"
},
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
],
"inboundNatRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"
}
]
}
}
],
"backendAddressPools": [
{
"name": "be-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb",
"type": "Microsoft.Network/loadBalancers/backendAddressPools",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
}
],
"loadBalancingRules": [
{
"name": "rulelb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb",
"type": "Microsoft.Network/loadBalancers/loadBalancingRules",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 80,
"backendPort": 80,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp",
"enableTcpReset": false,
"loadDistribution": "Default",
"backendAddressPool": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"
},
"probe": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"
},
"disableOutboundSnat": false
}
}
],
"probes": [
{
"name": "probe-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb",
"type": "Microsoft.Network/loadBalancers/probes",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"protocol": "Http",
"port": 80,
"requestPath": "healthcheck.aspx",
"intervalInSeconds": 15,
"numberOfProbes": 2,
"probeThreshold": 1,
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
}
],
"inboundNatRules": [
{
"name": "in-nat-rule",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule",
"type": "Microsoft.Network/loadBalancers/inboundNatRules",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 3389,
"backendPort": 3389,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp",
"enableTcpReset": false
}
}
],
"inboundNatPools": []
}
}
Create load balancer with Frontend IP in Zone 1
要求のサンプル
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb?api-version=2024-05-01
{
"location": "eastus",
"sku": {
"name": "Standard"
},
"properties": {
"frontendIPConfigurations": [
{
"name": "fe-lb",
"properties": {
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"
}
},
"zones": [
"1"
]
}
],
"backendAddressPools": [
{
"name": "be-lb",
"properties": {}
}
],
"loadBalancingRules": [
{
"name": "rulelb",
"properties": {
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 80,
"backendPort": 80,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp",
"loadDistribution": "Default",
"backendAddressPool": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"
},
"probe": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"
}
}
}
],
"probes": [
{
"name": "probe-lb",
"properties": {
"protocol": "Http",
"port": 80,
"requestPath": "healthcheck.aspx",
"intervalInSeconds": 15,
"numberOfProbes": 2,
"probeThreshold": 1
}
}
],
"inboundNatRules": [
{
"name": "in-nat-rule",
"properties": {
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 3389,
"backendPort": 3389,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp"
}
}
],
"inboundNatPools": [],
"outboundRules": []
}
}
import com.azure.core.management.SubResource;
import com.azure.resourcemanager.network.fluent.models.BackendAddressPoolInner;
import com.azure.resourcemanager.network.fluent.models.FrontendIpConfigurationInner;
import com.azure.resourcemanager.network.fluent.models.InboundNatRuleInner;
import com.azure.resourcemanager.network.fluent.models.LoadBalancerInner;
import com.azure.resourcemanager.network.fluent.models.LoadBalancingRuleInner;
import com.azure.resourcemanager.network.fluent.models.ProbeInner;
import com.azure.resourcemanager.network.fluent.models.SubnetInner;
import com.azure.resourcemanager.network.models.LoadBalancerSku;
import com.azure.resourcemanager.network.models.LoadBalancerSkuName;
import com.azure.resourcemanager.network.models.LoadDistribution;
import com.azure.resourcemanager.network.models.ProbeProtocol;
import com.azure.resourcemanager.network.models.TransportProtocol;
import java.util.Arrays;
/**
* Samples for LoadBalancers CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateWithZones.
* json
*/
/**
* Sample code: Create load balancer with Frontend IP in Zone 1.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createLoadBalancerWithFrontendIPInZone1(com.azure.resourcemanager.AzureResourceManager azure) {
azure.networks().manager().serviceClient().getLoadBalancers().createOrUpdate("rg1", "lb",
new LoadBalancerInner().withLocation("eastus")
.withSku(new LoadBalancerSku().withName(LoadBalancerSkuName.STANDARD))
.withFrontendIpConfigurations(Arrays.asList(new FrontendIpConfigurationInner().withName("fe-lb")
.withZones(Arrays.asList("1"))
.withSubnet(new SubnetInner().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"))))
.withBackendAddressPools(Arrays.asList(new BackendAddressPoolInner().withName("be-lb")))
.withLoadBalancingRules(Arrays.asList(new LoadBalancingRuleInner().withName("rulelb")
.withFrontendIpConfiguration(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"))
.withBackendAddressPool(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"))
.withProbe(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"))
.withProtocol(TransportProtocol.TCP).withLoadDistribution(LoadDistribution.DEFAULT)
.withFrontendPort(80).withBackendPort(80).withIdleTimeoutInMinutes(15).withEnableFloatingIp(true)))
.withProbes(Arrays.asList(new ProbeInner().withName("probe-lb").withProtocol(ProbeProtocol.HTTP)
.withPort(80).withIntervalInSeconds(15).withNumberOfProbes(2).withProbeThreshold(1)
.withRequestPath("healthcheck.aspx")))
.withInboundNatRules(Arrays.asList(new InboundNatRuleInner().withName("in-nat-rule")
.withFrontendIpConfiguration(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"))
.withProtocol(TransportProtocol.TCP).withFrontendPort(3389).withBackendPort(3389)
.withIdleTimeoutInMinutes(15).withEnableFloatingIp(true)))
.withInboundNatPools(Arrays.asList()).withOutboundRules(Arrays.asList()),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.network import NetworkManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-network
# USAGE
python load_balancer_create_with_zones.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = NetworkManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.load_balancers.begin_create_or_update(
resource_group_name="rg1",
load_balancer_name="lb",
parameters={
"location": "eastus",
"properties": {
"backendAddressPools": [{"name": "be-lb", "properties": {}}],
"frontendIPConfigurations": [
{
"name": "fe-lb",
"properties": {
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"
}
},
"zones": ["1"],
}
],
"inboundNatPools": [],
"inboundNatRules": [
{
"name": "in-nat-rule",
"properties": {
"backendPort": 3389,
"enableFloatingIP": True,
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 3389,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp",
},
}
],
"loadBalancingRules": [
{
"name": "rulelb",
"properties": {
"backendAddressPool": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"
},
"backendPort": 80,
"enableFloatingIP": True,
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 80,
"idleTimeoutInMinutes": 15,
"loadDistribution": "Default",
"probe": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"
},
"protocol": "Tcp",
},
}
],
"outboundRules": [],
"probes": [
{
"name": "probe-lb",
"properties": {
"intervalInSeconds": 15,
"numberOfProbes": 2,
"port": 80,
"probeThreshold": 1,
"protocol": "Http",
"requestPath": "healthcheck.aspx",
},
}
],
},
"sku": {"name": "Standard"},
},
).result()
print(response)
# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateWithZones.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armnetwork_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ab04533261eff228f28e08900445d0edef3eb70c/specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateWithZones.json
func ExampleLoadBalancersClient_BeginCreateOrUpdate_createLoadBalancerWithFrontendIpInZone1() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armnetwork.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewLoadBalancersClient().BeginCreateOrUpdate(ctx, "rg1", "lb", armnetwork.LoadBalancer{
Location: to.Ptr("eastus"),
Properties: &armnetwork.LoadBalancerPropertiesFormat{
BackendAddressPools: []*armnetwork.BackendAddressPool{
{
Name: to.Ptr("be-lb"),
Properties: &armnetwork.BackendAddressPoolPropertiesFormat{},
}},
FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{
{
Name: to.Ptr("fe-lb"),
Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{
Subnet: &armnetwork.Subnet{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"),
},
},
Zones: []*string{
to.Ptr("1")},
}},
InboundNatPools: []*armnetwork.InboundNatPool{},
InboundNatRules: []*armnetwork.InboundNatRule{
{
Name: to.Ptr("in-nat-rule"),
Properties: &armnetwork.InboundNatRulePropertiesFormat{
BackendPort: to.Ptr[int32](3389),
EnableFloatingIP: to.Ptr(true),
FrontendIPConfiguration: &armnetwork.SubResource{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
},
FrontendPort: to.Ptr[int32](3389),
IdleTimeoutInMinutes: to.Ptr[int32](15),
Protocol: to.Ptr(armnetwork.TransportProtocolTCP),
},
}},
LoadBalancingRules: []*armnetwork.LoadBalancingRule{
{
Name: to.Ptr("rulelb"),
Properties: &armnetwork.LoadBalancingRulePropertiesFormat{
BackendAddressPool: &armnetwork.SubResource{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"),
},
BackendPort: to.Ptr[int32](80),
EnableFloatingIP: to.Ptr(true),
FrontendIPConfiguration: &armnetwork.SubResource{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
},
FrontendPort: to.Ptr[int32](80),
IdleTimeoutInMinutes: to.Ptr[int32](15),
LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault),
Probe: &armnetwork.SubResource{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"),
},
Protocol: to.Ptr(armnetwork.TransportProtocolTCP),
},
}},
OutboundRules: []*armnetwork.OutboundRule{},
Probes: []*armnetwork.Probe{
{
Name: to.Ptr("probe-lb"),
Properties: &armnetwork.ProbePropertiesFormat{
IntervalInSeconds: to.Ptr[int32](15),
NumberOfProbes: to.Ptr[int32](2),
Port: to.Ptr[int32](80),
ProbeThreshold: to.Ptr[int32](1),
RequestPath: to.Ptr("healthcheck.aspx"),
Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP),
},
}},
},
SKU: &armnetwork.LoadBalancerSKU{
Name: to.Ptr(armnetwork.LoadBalancerSKUNameStandard),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.LoadBalancer = armnetwork.LoadBalancer{
// Name: to.Ptr("lb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb"),
// Location: to.Ptr("eastus"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.LoadBalancerPropertiesFormat{
// BackendAddressPools: []*armnetwork.BackendAddressPool{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"),
// Name: to.Ptr("be-lb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/backendAddressPools"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.BackendAddressPoolPropertiesFormat{
// LoadBalancingRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"),
// }},
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// },
// }},
// FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
// Name: to.Ptr("fe-lb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/frontendIPConfigurations"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{
// InboundNatRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"),
// }},
// LoadBalancingRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"),
// }},
// PrivateIPAddress: to.Ptr("10.0.1.4"),
// PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic),
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// Subnet: &armnetwork.Subnet{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"),
// },
// },
// Zones: []*string{
// to.Ptr("1")},
// }},
// InboundNatPools: []*armnetwork.InboundNatPool{
// },
// InboundNatRules: []*armnetwork.InboundNatRule{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"),
// Name: to.Ptr("in-nat-rule"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/inboundNatRules"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.InboundNatRulePropertiesFormat{
// BackendPort: to.Ptr[int32](3389),
// EnableFloatingIP: to.Ptr(true),
// FrontendIPConfiguration: &armnetwork.SubResource{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
// },
// FrontendPort: to.Ptr[int32](3389),
// IdleTimeoutInMinutes: to.Ptr[int32](15),
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// Protocol: to.Ptr(armnetwork.TransportProtocolTCP),
// },
// }},
// LoadBalancingRules: []*armnetwork.LoadBalancingRule{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"),
// Name: to.Ptr("rulelb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/loadBalancingRules"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.LoadBalancingRulePropertiesFormat{
// BackendAddressPool: &armnetwork.SubResource{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"),
// },
// BackendPort: to.Ptr[int32](80),
// DisableOutboundSnat: to.Ptr(false),
// EnableFloatingIP: to.Ptr(true),
// FrontendIPConfiguration: &armnetwork.SubResource{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
// },
// FrontendPort: to.Ptr[int32](80),
// IdleTimeoutInMinutes: to.Ptr[int32](15),
// LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault),
// Probe: &armnetwork.SubResource{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"),
// },
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// Protocol: to.Ptr(armnetwork.TransportProtocolTCP),
// },
// }},
// OutboundRules: []*armnetwork.OutboundRule{
// },
// Probes: []*armnetwork.Probe{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"),
// Name: to.Ptr("probe-lb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/probes"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.ProbePropertiesFormat{
// IntervalInSeconds: to.Ptr[int32](15),
// LoadBalancingRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"),
// }},
// NumberOfProbes: to.Ptr[int32](2),
// Port: to.Ptr[int32](80),
// ProbeThreshold: to.Ptr[int32](1),
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// RequestPath: to.Ptr("healthcheck.aspx"),
// Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP),
// },
// }},
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"),
// },
// SKU: &armnetwork.LoadBalancerSKU{
// Name: to.Ptr(armnetwork.LoadBalancerSKUNameStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { NetworkManagementClient } = require("@azure/arm-network");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates a load balancer.
*
* @summary Creates or updates a load balancer.
* x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateWithZones.json
*/
async function createLoadBalancerWithFrontendIPInZone1() {
const subscriptionId = process.env["NETWORK_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["NETWORK_RESOURCE_GROUP"] || "rg1";
const loadBalancerName = "lb";
const parameters = {
backendAddressPools: [{ name: "be-lb" }],
frontendIPConfigurations: [
{
name: "fe-lb",
subnet: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb",
},
zones: ["1"],
},
],
inboundNatPools: [],
inboundNatRules: [
{
name: "in-nat-rule",
backendPort: 3389,
enableFloatingIP: true,
frontendIPConfiguration: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb",
},
frontendPort: 3389,
idleTimeoutInMinutes: 15,
protocol: "Tcp",
},
],
loadBalancingRules: [
{
name: "rulelb",
backendAddressPool: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb",
},
backendPort: 80,
enableFloatingIP: true,
frontendIPConfiguration: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb",
},
frontendPort: 80,
idleTimeoutInMinutes: 15,
loadDistribution: "Default",
probe: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb",
},
protocol: "Tcp",
},
],
location: "eastus",
outboundRules: [],
probes: [
{
name: "probe-lb",
intervalInSeconds: 15,
numberOfProbes: 2,
port: 80,
probeThreshold: 1,
requestPath: "healthcheck.aspx",
protocol: "Http",
},
],
sku: { name: "Standard" },
};
const credential = new DefaultAzureCredential();
const client = new NetworkManagementClient(credential, subscriptionId);
const result = await client.loadBalancers.beginCreateOrUpdateAndWait(
resourceGroupName,
loadBalancerName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Network.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Resources.Models;
using Azure.ResourceManager.Network;
// Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateWithZones.json
// this example is just showing the usage of "LoadBalancers_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this LoadBalancerResource
LoadBalancerCollection collection = resourceGroupResource.GetLoadBalancers();
// invoke the operation
string loadBalancerName = "lb";
LoadBalancerData data = new LoadBalancerData
{
Sku = new LoadBalancerSku
{
Name = LoadBalancerSkuName.Standard,
},
FrontendIPConfigurations = {new FrontendIPConfigurationData
{
Zones = {"1"},
Subnet = new SubnetData
{
Id = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"),
},
Name = "fe-lb",
}},
BackendAddressPools = {new BackendAddressPoolData
{
Name = "be-lb",
}},
LoadBalancingRules = {new LoadBalancingRuleData
{
Properties = new LoadBalancingRuleProperties(LoadBalancingTransportProtocol.Tcp, 80)
{
FrontendIPConfigurationId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
BackendAddressPoolId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"),
ProbeId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"),
LoadDistribution = LoadDistribution.Default,
BackendPort = 80,
IdleTimeoutInMinutes = 15,
EnableFloatingIP = true,
},
Name = "rulelb",
}},
Probes = {new ProbeData
{
Protocol = ProbeProtocol.Http,
Port = 80,
IntervalInSeconds = 15,
NumberOfProbes = 2,
ProbeThreshold = 1,
RequestPath = "healthcheck.aspx",
Name = "probe-lb",
}},
InboundNatRules = {new InboundNatRuleData
{
FrontendIPConfigurationId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
Protocol = LoadBalancingTransportProtocol.Tcp,
FrontendPort = 3389,
BackendPort = 3389,
IdleTimeoutInMinutes = 15,
EnableFloatingIP = true,
Name = "in-nat-rule",
}},
InboundNatPools = { },
OutboundRules = { },
Location = new AzureLocation("eastus"),
};
ArmOperation<LoadBalancerResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, loadBalancerName, data);
LoadBalancerResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
LoadBalancerData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"name": "lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb",
"type": "Microsoft.Network/loadBalancers",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"location": "eastus",
"sku": {
"name": "Standard"
},
"properties": {
"provisioningState": "Succeeded",
"resourceGuid": "00000000-0000-0000-0000-00000000",
"frontendIPConfigurations": [
{
"name": "fe-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb",
"type": "Microsoft.Network/loadBalancers/frontendIPConfigurations",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"zones": [
"1"
],
"properties": {
"provisioningState": "Succeeded",
"privateIPAddress": "10.0.1.4",
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"
},
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
],
"inboundNatRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"
}
]
}
}
],
"backendAddressPools": [
{
"name": "be-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb",
"type": "Microsoft.Network/loadBalancers/backendAddressPools",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
}
],
"loadBalancingRules": [
{
"name": "rulelb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb",
"type": "Microsoft.Network/loadBalancers/loadBalancingRules",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 80,
"backendPort": 80,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp",
"loadDistribution": "Default",
"backendAddressPool": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"
},
"probe": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"
},
"disableOutboundSnat": false
}
}
],
"probes": [
{
"name": "probe-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb",
"type": "Microsoft.Network/loadBalancers/probes",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"protocol": "Http",
"port": 80,
"requestPath": "healthcheck.aspx",
"intervalInSeconds": 15,
"numberOfProbes": 2,
"probeThreshold": 1,
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
}
],
"inboundNatRules": [
{
"name": "in-nat-rule",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule",
"type": "Microsoft.Network/loadBalancers/inboundNatRules",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 3389,
"backendPort": 3389,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp"
}
}
],
"outboundRules": [],
"inboundNatPools": []
}
}
{
"name": "lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb",
"type": "Microsoft.Network/loadBalancers",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"location": "eastus",
"sku": {
"name": "Standard"
},
"properties": {
"provisioningState": "Succeeded",
"resourceGuid": "00000000-0000-0000-0000-00000000",
"frontendIPConfigurations": [
{
"name": "fe-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb",
"type": "Microsoft.Network/loadBalancers/frontendIPConfigurations",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"zones": [
"1"
],
"properties": {
"provisioningState": "Succeeded",
"privateIPAddress": "10.0.1.4",
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"
},
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
],
"inboundNatRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"
}
]
}
}
],
"backendAddressPools": [
{
"name": "be-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb",
"type": "Microsoft.Network/loadBalancers/backendAddressPools",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
}
],
"loadBalancingRules": [
{
"name": "rulelb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb",
"type": "Microsoft.Network/loadBalancers/loadBalancingRules",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 80,
"backendPort": 80,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp",
"loadDistribution": "Default",
"backendAddressPool": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"
},
"probe": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"
},
"disableOutboundSnat": false
}
}
],
"probes": [
{
"name": "probe-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb",
"type": "Microsoft.Network/loadBalancers/probes",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"protocol": "Http",
"port": 80,
"requestPath": "healthcheck.aspx",
"intervalInSeconds": 15,
"numberOfProbes": 2,
"probeThreshold": 1,
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
}
],
"inboundNatRules": [
{
"name": "in-nat-rule",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule",
"type": "Microsoft.Network/loadBalancers/inboundNatRules",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 3389,
"backendPort": 3389,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp"
}
}
],
"outboundRules": [],
"inboundNatPools": []
}
}
要求のサンプル
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb?api-version=2024-05-01
{
"location": "eastus",
"sku": {
"name": "Standard"
},
"properties": {
"frontendIPConfigurations": [
{
"name": "fe-lb",
"properties": {
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"
},
"gatewayLoadBalancer": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb-provider"
}
}
}
],
"backendAddressPools": [
{
"name": "be-lb",
"properties": {}
}
],
"loadBalancingRules": [
{
"name": "rulelb",
"properties": {
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 80,
"backendPort": 80,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp",
"loadDistribution": "Default",
"backendAddressPool": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"
},
"probe": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"
}
}
}
],
"probes": [
{
"name": "probe-lb",
"properties": {
"protocol": "Http",
"port": 80,
"requestPath": "healthcheck.aspx",
"intervalInSeconds": 15,
"numberOfProbes": 2,
"probeThreshold": 1
}
}
],
"inboundNatRules": [
{
"name": "in-nat-rule",
"properties": {
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 3389,
"backendPort": 3389,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp"
}
}
],
"inboundNatPools": [],
"outboundRules": []
}
}
import com.azure.core.management.SubResource;
import com.azure.resourcemanager.network.fluent.models.BackendAddressPoolInner;
import com.azure.resourcemanager.network.fluent.models.FrontendIpConfigurationInner;
import com.azure.resourcemanager.network.fluent.models.InboundNatRuleInner;
import com.azure.resourcemanager.network.fluent.models.LoadBalancerInner;
import com.azure.resourcemanager.network.fluent.models.LoadBalancingRuleInner;
import com.azure.resourcemanager.network.fluent.models.ProbeInner;
import com.azure.resourcemanager.network.fluent.models.SubnetInner;
import com.azure.resourcemanager.network.models.LoadBalancerSku;
import com.azure.resourcemanager.network.models.LoadBalancerSkuName;
import com.azure.resourcemanager.network.models.LoadDistribution;
import com.azure.resourcemanager.network.models.ProbeProtocol;
import com.azure.resourcemanager.network.models.TransportProtocol;
import java.util.Arrays;
/**
* Samples for LoadBalancers CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/
* LoadBalancerCreateGatewayLoadBalancerConsumer.json
*/
/**
* Sample code: Create load balancer with Gateway Load Balancer Consumer configured.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createLoadBalancerWithGatewayLoadBalancerConsumerConfigured(
com.azure.resourcemanager.AzureResourceManager azure) {
azure.networks().manager().serviceClient().getLoadBalancers().createOrUpdate("rg1", "lb",
new LoadBalancerInner().withLocation("eastus")
.withSku(new LoadBalancerSku().withName(LoadBalancerSkuName.STANDARD))
.withFrontendIpConfigurations(Arrays.asList(new FrontendIpConfigurationInner().withName("fe-lb")
.withSubnet(new SubnetInner().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"))
.withGatewayLoadBalancer(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb-provider"))))
.withBackendAddressPools(Arrays.asList(new BackendAddressPoolInner().withName("be-lb")))
.withLoadBalancingRules(Arrays.asList(new LoadBalancingRuleInner().withName("rulelb")
.withFrontendIpConfiguration(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"))
.withBackendAddressPool(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"))
.withProbe(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"))
.withProtocol(TransportProtocol.TCP).withLoadDistribution(LoadDistribution.DEFAULT)
.withFrontendPort(80).withBackendPort(80).withIdleTimeoutInMinutes(15).withEnableFloatingIp(true)))
.withProbes(Arrays.asList(new ProbeInner().withName("probe-lb").withProtocol(ProbeProtocol.HTTP)
.withPort(80).withIntervalInSeconds(15).withNumberOfProbes(2).withProbeThreshold(1)
.withRequestPath("healthcheck.aspx")))
.withInboundNatRules(Arrays.asList(new InboundNatRuleInner().withName("in-nat-rule")
.withFrontendIpConfiguration(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"))
.withProtocol(TransportProtocol.TCP).withFrontendPort(3389).withBackendPort(3389)
.withIdleTimeoutInMinutes(15).withEnableFloatingIp(true)))
.withInboundNatPools(Arrays.asList()).withOutboundRules(Arrays.asList()),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.network import NetworkManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-network
# USAGE
python load_balancer_create_gateway_load_balancer_consumer.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = NetworkManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.load_balancers.begin_create_or_update(
resource_group_name="rg1",
load_balancer_name="lb",
parameters={
"location": "eastus",
"properties": {
"backendAddressPools": [{"name": "be-lb", "properties": {}}],
"frontendIPConfigurations": [
{
"name": "fe-lb",
"properties": {
"gatewayLoadBalancer": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb-provider"
},
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"
},
},
}
],
"inboundNatPools": [],
"inboundNatRules": [
{
"name": "in-nat-rule",
"properties": {
"backendPort": 3389,
"enableFloatingIP": True,
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 3389,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp",
},
}
],
"loadBalancingRules": [
{
"name": "rulelb",
"properties": {
"backendAddressPool": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"
},
"backendPort": 80,
"enableFloatingIP": True,
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 80,
"idleTimeoutInMinutes": 15,
"loadDistribution": "Default",
"probe": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"
},
"protocol": "Tcp",
},
}
],
"outboundRules": [],
"probes": [
{
"name": "probe-lb",
"properties": {
"intervalInSeconds": 15,
"numberOfProbes": 2,
"port": 80,
"probeThreshold": 1,
"protocol": "Http",
"requestPath": "healthcheck.aspx",
},
}
],
},
"sku": {"name": "Standard"},
},
).result()
print(response)
# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateGatewayLoadBalancerConsumer.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armnetwork_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ab04533261eff228f28e08900445d0edef3eb70c/specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateGatewayLoadBalancerConsumer.json
func ExampleLoadBalancersClient_BeginCreateOrUpdate_createLoadBalancerWithGatewayLoadBalancerConsumerConfigured() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armnetwork.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewLoadBalancersClient().BeginCreateOrUpdate(ctx, "rg1", "lb", armnetwork.LoadBalancer{
Location: to.Ptr("eastus"),
Properties: &armnetwork.LoadBalancerPropertiesFormat{
BackendAddressPools: []*armnetwork.BackendAddressPool{
{
Name: to.Ptr("be-lb"),
Properties: &armnetwork.BackendAddressPoolPropertiesFormat{},
}},
FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{
{
Name: to.Ptr("fe-lb"),
Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{
GatewayLoadBalancer: &armnetwork.SubResource{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb-provider"),
},
Subnet: &armnetwork.Subnet{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"),
},
},
}},
InboundNatPools: []*armnetwork.InboundNatPool{},
InboundNatRules: []*armnetwork.InboundNatRule{
{
Name: to.Ptr("in-nat-rule"),
Properties: &armnetwork.InboundNatRulePropertiesFormat{
BackendPort: to.Ptr[int32](3389),
EnableFloatingIP: to.Ptr(true),
FrontendIPConfiguration: &armnetwork.SubResource{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
},
FrontendPort: to.Ptr[int32](3389),
IdleTimeoutInMinutes: to.Ptr[int32](15),
Protocol: to.Ptr(armnetwork.TransportProtocolTCP),
},
}},
LoadBalancingRules: []*armnetwork.LoadBalancingRule{
{
Name: to.Ptr("rulelb"),
Properties: &armnetwork.LoadBalancingRulePropertiesFormat{
BackendAddressPool: &armnetwork.SubResource{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"),
},
BackendPort: to.Ptr[int32](80),
EnableFloatingIP: to.Ptr(true),
FrontendIPConfiguration: &armnetwork.SubResource{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
},
FrontendPort: to.Ptr[int32](80),
IdleTimeoutInMinutes: to.Ptr[int32](15),
LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault),
Probe: &armnetwork.SubResource{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"),
},
Protocol: to.Ptr(armnetwork.TransportProtocolTCP),
},
}},
OutboundRules: []*armnetwork.OutboundRule{},
Probes: []*armnetwork.Probe{
{
Name: to.Ptr("probe-lb"),
Properties: &armnetwork.ProbePropertiesFormat{
IntervalInSeconds: to.Ptr[int32](15),
NumberOfProbes: to.Ptr[int32](2),
Port: to.Ptr[int32](80),
ProbeThreshold: to.Ptr[int32](1),
RequestPath: to.Ptr("healthcheck.aspx"),
Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP),
},
}},
},
SKU: &armnetwork.LoadBalancerSKU{
Name: to.Ptr(armnetwork.LoadBalancerSKUNameStandard),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.LoadBalancer = armnetwork.LoadBalancer{
// Name: to.Ptr("lb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb"),
// Location: to.Ptr("eastus"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.LoadBalancerPropertiesFormat{
// BackendAddressPools: []*armnetwork.BackendAddressPool{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"),
// Name: to.Ptr("be-lb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/backendAddressPools"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.BackendAddressPoolPropertiesFormat{
// LoadBalancingRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"),
// }},
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// },
// }},
// FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
// Name: to.Ptr("fe-lb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/frontendIPConfigurations"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{
// GatewayLoadBalancer: &armnetwork.SubResource{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb-provider"),
// },
// InboundNatRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"),
// }},
// LoadBalancingRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"),
// }},
// PrivateIPAddress: to.Ptr("10.0.1.4"),
// PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic),
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// Subnet: &armnetwork.Subnet{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"),
// },
// },
// }},
// InboundNatPools: []*armnetwork.InboundNatPool{
// },
// InboundNatRules: []*armnetwork.InboundNatRule{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"),
// Name: to.Ptr("in-nat-rule"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/inboundNatRules"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.InboundNatRulePropertiesFormat{
// BackendPort: to.Ptr[int32](3389),
// EnableFloatingIP: to.Ptr(true),
// FrontendIPConfiguration: &armnetwork.SubResource{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
// },
// FrontendPort: to.Ptr[int32](3389),
// IdleTimeoutInMinutes: to.Ptr[int32](15),
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// Protocol: to.Ptr(armnetwork.TransportProtocolTCP),
// },
// }},
// LoadBalancingRules: []*armnetwork.LoadBalancingRule{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"),
// Name: to.Ptr("rulelb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/loadBalancingRules"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.LoadBalancingRulePropertiesFormat{
// BackendAddressPool: &armnetwork.SubResource{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"),
// },
// BackendPort: to.Ptr[int32](80),
// DisableOutboundSnat: to.Ptr(false),
// EnableFloatingIP: to.Ptr(true),
// FrontendIPConfiguration: &armnetwork.SubResource{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
// },
// FrontendPort: to.Ptr[int32](80),
// IdleTimeoutInMinutes: to.Ptr[int32](15),
// LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault),
// Probe: &armnetwork.SubResource{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"),
// },
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// Protocol: to.Ptr(armnetwork.TransportProtocolTCP),
// },
// }},
// OutboundRules: []*armnetwork.OutboundRule{
// },
// Probes: []*armnetwork.Probe{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"),
// Name: to.Ptr("probe-lb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/probes"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.ProbePropertiesFormat{
// IntervalInSeconds: to.Ptr[int32](15),
// LoadBalancingRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"),
// }},
// NumberOfProbes: to.Ptr[int32](2),
// Port: to.Ptr[int32](80),
// ProbeThreshold: to.Ptr[int32](1),
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// RequestPath: to.Ptr("healthcheck.aspx"),
// Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP),
// },
// }},
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"),
// },
// SKU: &armnetwork.LoadBalancerSKU{
// Name: to.Ptr(armnetwork.LoadBalancerSKUNameStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { NetworkManagementClient } = require("@azure/arm-network");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates a load balancer.
*
* @summary Creates or updates a load balancer.
* x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateGatewayLoadBalancerConsumer.json
*/
async function createLoadBalancerWithGatewayLoadBalancerConsumerConfigured() {
const subscriptionId = process.env["NETWORK_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["NETWORK_RESOURCE_GROUP"] || "rg1";
const loadBalancerName = "lb";
const parameters = {
backendAddressPools: [{ name: "be-lb" }],
frontendIPConfigurations: [
{
name: "fe-lb",
gatewayLoadBalancer: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb-provider",
},
subnet: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb",
},
},
],
inboundNatPools: [],
inboundNatRules: [
{
name: "in-nat-rule",
backendPort: 3389,
enableFloatingIP: true,
frontendIPConfiguration: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb",
},
frontendPort: 3389,
idleTimeoutInMinutes: 15,
protocol: "Tcp",
},
],
loadBalancingRules: [
{
name: "rulelb",
backendAddressPool: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb",
},
backendPort: 80,
enableFloatingIP: true,
frontendIPConfiguration: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb",
},
frontendPort: 80,
idleTimeoutInMinutes: 15,
loadDistribution: "Default",
probe: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb",
},
protocol: "Tcp",
},
],
location: "eastus",
outboundRules: [],
probes: [
{
name: "probe-lb",
intervalInSeconds: 15,
numberOfProbes: 2,
port: 80,
probeThreshold: 1,
requestPath: "healthcheck.aspx",
protocol: "Http",
},
],
sku: { name: "Standard" },
};
const credential = new DefaultAzureCredential();
const client = new NetworkManagementClient(credential, subscriptionId);
const result = await client.loadBalancers.beginCreateOrUpdateAndWait(
resourceGroupName,
loadBalancerName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Network.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Resources.Models;
using Azure.ResourceManager.Network;
// Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateGatewayLoadBalancerConsumer.json
// this example is just showing the usage of "LoadBalancers_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this LoadBalancerResource
LoadBalancerCollection collection = resourceGroupResource.GetLoadBalancers();
// invoke the operation
string loadBalancerName = "lb";
LoadBalancerData data = new LoadBalancerData
{
Sku = new LoadBalancerSku
{
Name = LoadBalancerSkuName.Standard,
},
FrontendIPConfigurations = {new FrontendIPConfigurationData
{
Subnet = new SubnetData
{
Id = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"),
},
GatewayLoadBalancerId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb-provider"),
Name = "fe-lb",
}},
BackendAddressPools = {new BackendAddressPoolData
{
Name = "be-lb",
}},
LoadBalancingRules = {new LoadBalancingRuleData
{
Properties = new LoadBalancingRuleProperties(LoadBalancingTransportProtocol.Tcp, 80)
{
FrontendIPConfigurationId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
BackendAddressPoolId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"),
ProbeId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"),
LoadDistribution = LoadDistribution.Default,
BackendPort = 80,
IdleTimeoutInMinutes = 15,
EnableFloatingIP = true,
},
Name = "rulelb",
}},
Probes = {new ProbeData
{
Protocol = ProbeProtocol.Http,
Port = 80,
IntervalInSeconds = 15,
NumberOfProbes = 2,
ProbeThreshold = 1,
RequestPath = "healthcheck.aspx",
Name = "probe-lb",
}},
InboundNatRules = {new InboundNatRuleData
{
FrontendIPConfigurationId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
Protocol = LoadBalancingTransportProtocol.Tcp,
FrontendPort = 3389,
BackendPort = 3389,
IdleTimeoutInMinutes = 15,
EnableFloatingIP = true,
Name = "in-nat-rule",
}},
InboundNatPools = { },
OutboundRules = { },
Location = new AzureLocation("eastus"),
};
ArmOperation<LoadBalancerResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, loadBalancerName, data);
LoadBalancerResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
LoadBalancerData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"name": "lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb",
"type": "Microsoft.Network/loadBalancers",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"location": "eastus",
"sku": {
"name": "Standard"
},
"properties": {
"provisioningState": "Succeeded",
"resourceGuid": "00000000-0000-0000-0000-00000000",
"frontendIPConfigurations": [
{
"name": "fe-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb",
"type": "Microsoft.Network/loadBalancers/frontendIPConfigurations",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"privateIPAddress": "10.0.1.4",
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"
},
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
],
"inboundNatRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"
}
],
"gatewayLoadBalancer": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb-provider"
}
}
}
],
"backendAddressPools": [
{
"name": "be-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb",
"type": "Microsoft.Network/loadBalancers/backendAddressPools",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
}
],
"loadBalancingRules": [
{
"name": "rulelb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb",
"type": "Microsoft.Network/loadBalancers/loadBalancingRules",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 80,
"backendPort": 80,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp",
"loadDistribution": "Default",
"backendAddressPool": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"
},
"probe": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"
},
"disableOutboundSnat": false
}
}
],
"probes": [
{
"name": "probe-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb",
"type": "Microsoft.Network/loadBalancers/probes",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"protocol": "Http",
"port": 80,
"requestPath": "healthcheck.aspx",
"intervalInSeconds": 15,
"numberOfProbes": 2,
"probeThreshold": 1,
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
}
],
"inboundNatRules": [
{
"name": "in-nat-rule",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule",
"type": "Microsoft.Network/loadBalancers/inboundNatRules",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 3389,
"backendPort": 3389,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp"
}
}
],
"outboundRules": [],
"inboundNatPools": []
}
}
{
"name": "lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb",
"type": "Microsoft.Network/loadBalancers",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"location": "eastus",
"sku": {
"name": "Standard"
},
"properties": {
"provisioningState": "Succeeded",
"resourceGuid": "00000000-0000-0000-0000-00000000",
"frontendIPConfigurations": [
{
"name": "fe-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb",
"type": "Microsoft.Network/loadBalancers/frontendIPConfigurations",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"privateIPAddress": "10.0.1.4",
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"
},
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
],
"inboundNatRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"
}
],
"gatewayLoadBalancer": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb-provider"
}
}
}
],
"backendAddressPools": [
{
"name": "be-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb",
"type": "Microsoft.Network/loadBalancers/backendAddressPools",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
}
],
"loadBalancingRules": [
{
"name": "rulelb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb",
"type": "Microsoft.Network/loadBalancers/loadBalancingRules",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 80,
"backendPort": 80,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp",
"loadDistribution": "Default",
"backendAddressPool": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"
},
"probe": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"
},
"disableOutboundSnat": false
}
}
],
"probes": [
{
"name": "probe-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb",
"type": "Microsoft.Network/loadBalancers/probes",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"protocol": "Http",
"port": 80,
"requestPath": "healthcheck.aspx",
"intervalInSeconds": 15,
"numberOfProbes": 2,
"probeThreshold": 1,
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
}
],
"inboundNatRules": [
{
"name": "in-nat-rule",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule",
"type": "Microsoft.Network/loadBalancers/inboundNatRules",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 3389,
"backendPort": 3389,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp"
}
}
],
"outboundRules": [],
"inboundNatPools": []
}
}
要求のサンプル
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb?api-version=2024-05-01
{
"location": "eastus",
"sku": {
"name": "Gateway"
},
"properties": {
"frontendIPConfigurations": [
{
"name": "fe-lb",
"properties": {
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"
}
}
}
],
"backendAddressPools": [
{
"name": "be-lb",
"properties": {
"tunnelInterfaces": [
{
"port": 15000,
"identifier": 900,
"protocol": "VXLAN",
"type": "Internal"
},
{
"port": 15001,
"identifier": 901,
"protocol": "VXLAN",
"type": "Internal"
}
]
}
}
],
"loadBalancingRules": [
{
"name": "rulelb",
"properties": {
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 0,
"backendPort": 0,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "All",
"loadDistribution": "Default",
"backendAddressPools": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"
}
],
"probe": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"
}
}
}
],
"probes": [
{
"name": "probe-lb",
"properties": {
"protocol": "Http",
"port": 80,
"requestPath": "healthcheck.aspx",
"intervalInSeconds": 15,
"numberOfProbes": 2,
"probeThreshold": 1
}
}
],
"inboundNatPools": [],
"outboundRules": []
}
}
import com.azure.core.management.SubResource;
import com.azure.resourcemanager.network.fluent.models.BackendAddressPoolInner;
import com.azure.resourcemanager.network.fluent.models.FrontendIpConfigurationInner;
import com.azure.resourcemanager.network.fluent.models.LoadBalancerInner;
import com.azure.resourcemanager.network.fluent.models.LoadBalancingRuleInner;
import com.azure.resourcemanager.network.fluent.models.ProbeInner;
import com.azure.resourcemanager.network.fluent.models.SubnetInner;
import com.azure.resourcemanager.network.models.GatewayLoadBalancerTunnelInterface;
import com.azure.resourcemanager.network.models.GatewayLoadBalancerTunnelInterfaceType;
import com.azure.resourcemanager.network.models.GatewayLoadBalancerTunnelProtocol;
import com.azure.resourcemanager.network.models.LoadBalancerSku;
import com.azure.resourcemanager.network.models.LoadBalancerSkuName;
import com.azure.resourcemanager.network.models.LoadDistribution;
import com.azure.resourcemanager.network.models.ProbeProtocol;
import com.azure.resourcemanager.network.models.TransportProtocol;
import java.util.Arrays;
/**
* Samples for LoadBalancers CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/
* LoadBalancerCreateGatewayLoadBalancerProviderWithOneBackendPool.json
*/
/**
* Sample code: Create load balancer with Gateway Load Balancer Provider configured with one Backend Pool.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createLoadBalancerWithGatewayLoadBalancerProviderConfiguredWithOneBackendPool(
com.azure.resourcemanager.AzureResourceManager azure) {
azure.networks().manager().serviceClient().getLoadBalancers().createOrUpdate("rg1", "lb",
new LoadBalancerInner().withLocation("eastus")
.withSku(new LoadBalancerSku().withName(LoadBalancerSkuName.GATEWAY))
.withFrontendIpConfigurations(Arrays.asList(new FrontendIpConfigurationInner().withName("fe-lb")
.withSubnet(new SubnetInner().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"))))
.withBackendAddressPools(Arrays.asList(new BackendAddressPoolInner().withName("be-lb")
.withTunnelInterfaces(Arrays.asList(
new GatewayLoadBalancerTunnelInterface().withPort(15000).withIdentifier(900)
.withProtocol(GatewayLoadBalancerTunnelProtocol.VXLAN)
.withType(GatewayLoadBalancerTunnelInterfaceType.INTERNAL),
new GatewayLoadBalancerTunnelInterface().withPort(15001).withIdentifier(901)
.withProtocol(GatewayLoadBalancerTunnelProtocol.VXLAN)
.withType(GatewayLoadBalancerTunnelInterfaceType.INTERNAL)))))
.withLoadBalancingRules(Arrays.asList(new LoadBalancingRuleInner().withName("rulelb")
.withFrontendIpConfiguration(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"))
.withBackendAddressPools(Arrays.asList(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb")))
.withProbe(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"))
.withProtocol(TransportProtocol.ALL).withLoadDistribution(LoadDistribution.DEFAULT)
.withFrontendPort(0).withBackendPort(0).withIdleTimeoutInMinutes(15).withEnableFloatingIp(true)))
.withProbes(Arrays.asList(new ProbeInner().withName("probe-lb").withProtocol(ProbeProtocol.HTTP)
.withPort(80).withIntervalInSeconds(15).withNumberOfProbes(2).withProbeThreshold(1)
.withRequestPath("healthcheck.aspx")))
.withInboundNatPools(Arrays.asList()).withOutboundRules(Arrays.asList()),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.network import NetworkManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-network
# USAGE
python load_balancer_create_gateway_load_balancer_provider_with_one_backend_pool.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = NetworkManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.load_balancers.begin_create_or_update(
resource_group_name="rg1",
load_balancer_name="lb",
parameters={
"location": "eastus",
"properties": {
"backendAddressPools": [
{
"name": "be-lb",
"properties": {
"tunnelInterfaces": [
{"identifier": 900, "port": 15000, "protocol": "VXLAN", "type": "Internal"},
{"identifier": 901, "port": 15001, "protocol": "VXLAN", "type": "Internal"},
]
},
}
],
"frontendIPConfigurations": [
{
"name": "fe-lb",
"properties": {
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"
}
},
}
],
"inboundNatPools": [],
"loadBalancingRules": [
{
"name": "rulelb",
"properties": {
"backendAddressPools": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"
}
],
"backendPort": 0,
"enableFloatingIP": True,
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 0,
"idleTimeoutInMinutes": 15,
"loadDistribution": "Default",
"probe": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"
},
"protocol": "All",
},
}
],
"outboundRules": [],
"probes": [
{
"name": "probe-lb",
"properties": {
"intervalInSeconds": 15,
"numberOfProbes": 2,
"port": 80,
"probeThreshold": 1,
"protocol": "Http",
"requestPath": "healthcheck.aspx",
},
}
],
},
"sku": {"name": "Gateway"},
},
).result()
print(response)
# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateGatewayLoadBalancerProviderWithOneBackendPool.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armnetwork_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ab04533261eff228f28e08900445d0edef3eb70c/specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateGatewayLoadBalancerProviderWithOneBackendPool.json
func ExampleLoadBalancersClient_BeginCreateOrUpdate_createLoadBalancerWithGatewayLoadBalancerProviderConfiguredWithOneBackendPool() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armnetwork.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewLoadBalancersClient().BeginCreateOrUpdate(ctx, "rg1", "lb", armnetwork.LoadBalancer{
Location: to.Ptr("eastus"),
Properties: &armnetwork.LoadBalancerPropertiesFormat{
BackendAddressPools: []*armnetwork.BackendAddressPool{
{
Name: to.Ptr("be-lb"),
Properties: &armnetwork.BackendAddressPoolPropertiesFormat{
TunnelInterfaces: []*armnetwork.GatewayLoadBalancerTunnelInterface{
{
Type: to.Ptr(armnetwork.GatewayLoadBalancerTunnelInterfaceTypeInternal),
Identifier: to.Ptr[int32](900),
Port: to.Ptr[int32](15000),
Protocol: to.Ptr(armnetwork.GatewayLoadBalancerTunnelProtocolVXLAN),
},
{
Type: to.Ptr(armnetwork.GatewayLoadBalancerTunnelInterfaceTypeInternal),
Identifier: to.Ptr[int32](901),
Port: to.Ptr[int32](15001),
Protocol: to.Ptr(armnetwork.GatewayLoadBalancerTunnelProtocolVXLAN),
}},
},
}},
FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{
{
Name: to.Ptr("fe-lb"),
Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{
Subnet: &armnetwork.Subnet{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"),
},
},
}},
InboundNatPools: []*armnetwork.InboundNatPool{},
LoadBalancingRules: []*armnetwork.LoadBalancingRule{
{
Name: to.Ptr("rulelb"),
Properties: &armnetwork.LoadBalancingRulePropertiesFormat{
BackendAddressPools: []*armnetwork.SubResource{
{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"),
}},
BackendPort: to.Ptr[int32](0),
EnableFloatingIP: to.Ptr(true),
FrontendIPConfiguration: &armnetwork.SubResource{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
},
FrontendPort: to.Ptr[int32](0),
IdleTimeoutInMinutes: to.Ptr[int32](15),
LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault),
Probe: &armnetwork.SubResource{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"),
},
Protocol: to.Ptr(armnetwork.TransportProtocolAll),
},
}},
OutboundRules: []*armnetwork.OutboundRule{},
Probes: []*armnetwork.Probe{
{
Name: to.Ptr("probe-lb"),
Properties: &armnetwork.ProbePropertiesFormat{
IntervalInSeconds: to.Ptr[int32](15),
NumberOfProbes: to.Ptr[int32](2),
Port: to.Ptr[int32](80),
ProbeThreshold: to.Ptr[int32](1),
RequestPath: to.Ptr("healthcheck.aspx"),
Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP),
},
}},
},
SKU: &armnetwork.LoadBalancerSKU{
Name: to.Ptr(armnetwork.LoadBalancerSKUNameGateway),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.LoadBalancer = armnetwork.LoadBalancer{
// Name: to.Ptr("lb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb"),
// Location: to.Ptr("eastus"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.LoadBalancerPropertiesFormat{
// BackendAddressPools: []*armnetwork.BackendAddressPool{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"),
// Name: to.Ptr("be-lb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/backendAddressPools"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.BackendAddressPoolPropertiesFormat{
// LoadBalancingRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"),
// }},
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// TunnelInterfaces: []*armnetwork.GatewayLoadBalancerTunnelInterface{
// {
// Type: to.Ptr(armnetwork.GatewayLoadBalancerTunnelInterfaceTypeInternal),
// Identifier: to.Ptr[int32](900),
// Port: to.Ptr[int32](15000),
// Protocol: to.Ptr(armnetwork.GatewayLoadBalancerTunnelProtocolVXLAN),
// },
// {
// Type: to.Ptr(armnetwork.GatewayLoadBalancerTunnelInterfaceTypeInternal),
// Identifier: to.Ptr[int32](901),
// Port: to.Ptr[int32](15001),
// Protocol: to.Ptr(armnetwork.GatewayLoadBalancerTunnelProtocolVXLAN),
// }},
// },
// }},
// FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
// Name: to.Ptr("fe-lb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/frontendIPConfigurations"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{
// InboundNatRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"),
// }},
// LoadBalancingRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"),
// }},
// PrivateIPAddress: to.Ptr("10.0.1.4"),
// PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic),
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// Subnet: &armnetwork.Subnet{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"),
// },
// },
// }},
// InboundNatPools: []*armnetwork.InboundNatPool{
// },
// LoadBalancingRules: []*armnetwork.LoadBalancingRule{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"),
// Name: to.Ptr("rulelb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/loadBalancingRules"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.LoadBalancingRulePropertiesFormat{
// BackendAddressPools: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"),
// }},
// BackendPort: to.Ptr[int32](80),
// DisableOutboundSnat: to.Ptr(false),
// EnableFloatingIP: to.Ptr(true),
// FrontendIPConfiguration: &armnetwork.SubResource{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
// },
// FrontendPort: to.Ptr[int32](80),
// IdleTimeoutInMinutes: to.Ptr[int32](15),
// LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault),
// Probe: &armnetwork.SubResource{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"),
// },
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// Protocol: to.Ptr(armnetwork.TransportProtocolTCP),
// },
// }},
// OutboundRules: []*armnetwork.OutboundRule{
// },
// Probes: []*armnetwork.Probe{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"),
// Name: to.Ptr("probe-lb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/probes"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.ProbePropertiesFormat{
// IntervalInSeconds: to.Ptr[int32](15),
// LoadBalancingRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"),
// }},
// NumberOfProbes: to.Ptr[int32](2),
// Port: to.Ptr[int32](80),
// ProbeThreshold: to.Ptr[int32](1),
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// RequestPath: to.Ptr("healthcheck.aspx"),
// Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP),
// },
// }},
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"),
// },
// SKU: &armnetwork.LoadBalancerSKU{
// Name: to.Ptr(armnetwork.LoadBalancerSKUNameGateway),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { NetworkManagementClient } = require("@azure/arm-network");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates a load balancer.
*
* @summary Creates or updates a load balancer.
* x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateGatewayLoadBalancerProviderWithOneBackendPool.json
*/
async function createLoadBalancerWithGatewayLoadBalancerProviderConfiguredWithOneBackendPool() {
const subscriptionId = process.env["NETWORK_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["NETWORK_RESOURCE_GROUP"] || "rg1";
const loadBalancerName = "lb";
const parameters = {
backendAddressPools: [
{
name: "be-lb",
tunnelInterfaces: [
{ type: "Internal", identifier: 900, port: 15000, protocol: "VXLAN" },
{ type: "Internal", identifier: 901, port: 15001, protocol: "VXLAN" },
],
},
],
frontendIPConfigurations: [
{
name: "fe-lb",
subnet: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb",
},
},
],
inboundNatPools: [],
loadBalancingRules: [
{
name: "rulelb",
backendAddressPools: [
{
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb",
},
],
backendPort: 0,
enableFloatingIP: true,
frontendIPConfiguration: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb",
},
frontendPort: 0,
idleTimeoutInMinutes: 15,
loadDistribution: "Default",
probe: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb",
},
protocol: "All",
},
],
location: "eastus",
outboundRules: [],
probes: [
{
name: "probe-lb",
intervalInSeconds: 15,
numberOfProbes: 2,
port: 80,
probeThreshold: 1,
requestPath: "healthcheck.aspx",
protocol: "Http",
},
],
sku: { name: "Gateway" },
};
const credential = new DefaultAzureCredential();
const client = new NetworkManagementClient(credential, subscriptionId);
const result = await client.loadBalancers.beginCreateOrUpdateAndWait(
resourceGroupName,
loadBalancerName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Network.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Resources.Models;
using Azure.ResourceManager.Network;
// Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateGatewayLoadBalancerProviderWithOneBackendPool.json
// this example is just showing the usage of "LoadBalancers_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this LoadBalancerResource
LoadBalancerCollection collection = resourceGroupResource.GetLoadBalancers();
// invoke the operation
string loadBalancerName = "lb";
LoadBalancerData data = new LoadBalancerData
{
Sku = new LoadBalancerSku
{
Name = LoadBalancerSkuName.Gateway,
},
FrontendIPConfigurations = {new FrontendIPConfigurationData
{
Subnet = new SubnetData
{
Id = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"),
},
Name = "fe-lb",
}},
BackendAddressPools = {new BackendAddressPoolData
{
TunnelInterfaces = {new GatewayLoadBalancerTunnelInterface
{
Port = 15000,
Identifier = 900,
Protocol = GatewayLoadBalancerTunnelProtocol.Vxlan,
InterfaceType = GatewayLoadBalancerTunnelInterfaceType.Internal,
}, new GatewayLoadBalancerTunnelInterface
{
Port = 15001,
Identifier = 901,
Protocol = GatewayLoadBalancerTunnelProtocol.Vxlan,
InterfaceType = GatewayLoadBalancerTunnelInterfaceType.Internal,
}},
Name = "be-lb",
}},
LoadBalancingRules = {new LoadBalancingRuleData
{
Properties = new LoadBalancingRuleProperties(LoadBalancingTransportProtocol.All, 0)
{
FrontendIPConfigurationId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
BackendAddressPools = {new WritableSubResource
{
Id = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"),
}},
ProbeId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"),
LoadDistribution = LoadDistribution.Default,
BackendPort = 0,
IdleTimeoutInMinutes = 15,
EnableFloatingIP = true,
},
Name = "rulelb",
}},
Probes = {new ProbeData
{
Protocol = ProbeProtocol.Http,
Port = 80,
IntervalInSeconds = 15,
NumberOfProbes = 2,
ProbeThreshold = 1,
RequestPath = "healthcheck.aspx",
Name = "probe-lb",
}},
InboundNatPools = { },
OutboundRules = { },
Location = new AzureLocation("eastus"),
};
ArmOperation<LoadBalancerResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, loadBalancerName, data);
LoadBalancerResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
LoadBalancerData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"name": "lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb",
"type": "Microsoft.Network/loadBalancers",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"location": "eastus",
"sku": {
"name": "Gateway"
},
"properties": {
"provisioningState": "Succeeded",
"resourceGuid": "00000000-0000-0000-0000-00000000",
"frontendIPConfigurations": [
{
"name": "fe-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb",
"type": "Microsoft.Network/loadBalancers/frontendIPConfigurations",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"privateIPAddress": "10.0.1.4",
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"
},
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
],
"inboundNatRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"
}
]
}
}
],
"backendAddressPools": [
{
"name": "be-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb",
"type": "Microsoft.Network/loadBalancers/backendAddressPools",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"tunnelInterfaces": [
{
"port": 15000,
"identifier": 900,
"protocol": "VXLAN",
"type": "Internal"
},
{
"port": 15001,
"identifier": 901,
"protocol": "VXLAN",
"type": "Internal"
}
],
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
}
],
"loadBalancingRules": [
{
"name": "rulelb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb",
"type": "Microsoft.Network/loadBalancers/loadBalancingRules",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 80,
"backendPort": 80,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp",
"loadDistribution": "Default",
"backendAddressPools": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"
}
],
"probe": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"
},
"disableOutboundSnat": false
}
}
],
"probes": [
{
"name": "probe-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb",
"type": "Microsoft.Network/loadBalancers/probes",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"protocol": "Http",
"port": 80,
"requestPath": "healthcheck.aspx",
"intervalInSeconds": 15,
"numberOfProbes": 2,
"probeThreshold": 1,
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
}
],
"outboundRules": [],
"inboundNatPools": []
}
}
{
"name": "lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb",
"type": "Microsoft.Network/loadBalancers",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"location": "eastus",
"sku": {
"name": "Gateway"
},
"properties": {
"provisioningState": "Succeeded",
"resourceGuid": "00000000-0000-0000-0000-00000000",
"frontendIPConfigurations": [
{
"name": "fe-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb",
"type": "Microsoft.Network/loadBalancers/frontendIPConfigurations",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"privateIPAddress": "10.0.1.4",
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"
},
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
}
],
"backendAddressPools": [
{
"name": "be-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb",
"type": "Microsoft.Network/loadBalancers/backendAddressPools",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"tunnelInterfaces": [
{
"port": 15000,
"identifier": 900,
"protocol": "VXLAN",
"type": "Internal"
},
{
"port": 15001,
"identifier": 901,
"protocol": "VXLAN",
"type": "Internal"
}
],
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
}
],
"loadBalancingRules": [
{
"name": "rulelb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb",
"type": "Microsoft.Network/loadBalancers/loadBalancingRules",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 80,
"backendPort": 80,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp",
"loadDistribution": "Default",
"backendAddressPools": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"
}
],
"probe": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"
},
"disableOutboundSnat": false
}
}
],
"probes": [
{
"name": "probe-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb",
"type": "Microsoft.Network/loadBalancers/probes",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"protocol": "Http",
"port": 80,
"requestPath": "healthcheck.aspx",
"intervalInSeconds": 15,
"numberOfProbes": 2,
"probeThreshold": 1,
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
}
],
"outboundRules": [],
"inboundNatPools": []
}
}
要求のサンプル
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb?api-version=2024-05-01
{
"location": "eastus",
"sku": {
"name": "Gateway"
},
"properties": {
"frontendIPConfigurations": [
{
"name": "fe-lb",
"properties": {
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"
}
}
}
],
"backendAddressPools": [
{
"name": "be-lb1",
"properties": {}
},
{
"name": "be-lb2",
"properties": {}
}
],
"loadBalancingRules": [
{
"name": "rulelb",
"properties": {
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 0,
"backendPort": 0,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "All",
"loadDistribution": "Default",
"backendAddressPool": {},
"backendAddressPools": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb1"
},
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb2"
}
],
"probe": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"
}
}
}
],
"probes": [
{
"name": "probe-lb",
"properties": {
"protocol": "Http",
"port": 80,
"requestPath": "healthcheck.aspx",
"intervalInSeconds": 15,
"numberOfProbes": 2,
"probeThreshold": 1
}
}
],
"inboundNatPools": [],
"outboundRules": []
}
}
import com.azure.core.management.SubResource;
import com.azure.resourcemanager.network.fluent.models.BackendAddressPoolInner;
import com.azure.resourcemanager.network.fluent.models.FrontendIpConfigurationInner;
import com.azure.resourcemanager.network.fluent.models.LoadBalancerInner;
import com.azure.resourcemanager.network.fluent.models.LoadBalancingRuleInner;
import com.azure.resourcemanager.network.fluent.models.ProbeInner;
import com.azure.resourcemanager.network.fluent.models.SubnetInner;
import com.azure.resourcemanager.network.models.LoadBalancerSku;
import com.azure.resourcemanager.network.models.LoadBalancerSkuName;
import com.azure.resourcemanager.network.models.LoadDistribution;
import com.azure.resourcemanager.network.models.ProbeProtocol;
import com.azure.resourcemanager.network.models.TransportProtocol;
import java.util.Arrays;
/**
* Samples for LoadBalancers CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/
* LoadBalancerCreateGatewayLoadBalancerProviderWithTwoBackendPool.json
*/
/**
* Sample code: Create load balancer with Gateway Load Balancer Provider configured with two Backend Pool.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createLoadBalancerWithGatewayLoadBalancerProviderConfiguredWithTwoBackendPool(
com.azure.resourcemanager.AzureResourceManager azure) {
azure.networks().manager().serviceClient().getLoadBalancers().createOrUpdate("rg1", "lb",
new LoadBalancerInner().withLocation("eastus")
.withSku(new LoadBalancerSku().withName(LoadBalancerSkuName.GATEWAY))
.withFrontendIpConfigurations(Arrays.asList(new FrontendIpConfigurationInner().withName("fe-lb")
.withSubnet(new SubnetInner().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"))))
.withBackendAddressPools(Arrays.asList(new BackendAddressPoolInner().withName("be-lb1"),
new BackendAddressPoolInner().withName("be-lb2")))
.withLoadBalancingRules(Arrays.asList(new LoadBalancingRuleInner().withName("rulelb")
.withFrontendIpConfiguration(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"))
.withBackendAddressPool(new SubResource())
.withBackendAddressPools(Arrays.asList(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb1"),
new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb2")))
.withProbe(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"))
.withProtocol(TransportProtocol.ALL).withLoadDistribution(LoadDistribution.DEFAULT)
.withFrontendPort(0).withBackendPort(0).withIdleTimeoutInMinutes(15).withEnableFloatingIp(true)))
.withProbes(Arrays.asList(new ProbeInner().withName("probe-lb").withProtocol(ProbeProtocol.HTTP)
.withPort(80).withIntervalInSeconds(15).withNumberOfProbes(2).withProbeThreshold(1)
.withRequestPath("healthcheck.aspx")))
.withInboundNatPools(Arrays.asList()).withOutboundRules(Arrays.asList()),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.network import NetworkManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-network
# USAGE
python load_balancer_create_gateway_load_balancer_provider_with_two_backend_pool.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = NetworkManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.load_balancers.begin_create_or_update(
resource_group_name="rg1",
load_balancer_name="lb",
parameters={
"location": "eastus",
"properties": {
"backendAddressPools": [{"name": "be-lb1", "properties": {}}, {"name": "be-lb2", "properties": {}}],
"frontendIPConfigurations": [
{
"name": "fe-lb",
"properties": {
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"
}
},
}
],
"inboundNatPools": [],
"loadBalancingRules": [
{
"name": "rulelb",
"properties": {
"backendAddressPool": {},
"backendAddressPools": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb1"
},
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb2"
},
],
"backendPort": 0,
"enableFloatingIP": True,
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 0,
"idleTimeoutInMinutes": 15,
"loadDistribution": "Default",
"probe": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"
},
"protocol": "All",
},
}
],
"outboundRules": [],
"probes": [
{
"name": "probe-lb",
"properties": {
"intervalInSeconds": 15,
"numberOfProbes": 2,
"port": 80,
"probeThreshold": 1,
"protocol": "Http",
"requestPath": "healthcheck.aspx",
},
}
],
},
"sku": {"name": "Gateway"},
},
).result()
print(response)
# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateGatewayLoadBalancerProviderWithTwoBackendPool.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armnetwork_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ab04533261eff228f28e08900445d0edef3eb70c/specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateGatewayLoadBalancerProviderWithTwoBackendPool.json
func ExampleLoadBalancersClient_BeginCreateOrUpdate_createLoadBalancerWithGatewayLoadBalancerProviderConfiguredWithTwoBackendPool() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armnetwork.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewLoadBalancersClient().BeginCreateOrUpdate(ctx, "rg1", "lb", armnetwork.LoadBalancer{
Location: to.Ptr("eastus"),
Properties: &armnetwork.LoadBalancerPropertiesFormat{
BackendAddressPools: []*armnetwork.BackendAddressPool{
{
Name: to.Ptr("be-lb1"),
Properties: &armnetwork.BackendAddressPoolPropertiesFormat{},
},
{
Name: to.Ptr("be-lb2"),
Properties: &armnetwork.BackendAddressPoolPropertiesFormat{},
}},
FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{
{
Name: to.Ptr("fe-lb"),
Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{
Subnet: &armnetwork.Subnet{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"),
},
},
}},
InboundNatPools: []*armnetwork.InboundNatPool{},
LoadBalancingRules: []*armnetwork.LoadBalancingRule{
{
Name: to.Ptr("rulelb"),
Properties: &armnetwork.LoadBalancingRulePropertiesFormat{
BackendAddressPool: &armnetwork.SubResource{},
BackendAddressPools: []*armnetwork.SubResource{
{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb1"),
},
{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb2"),
}},
BackendPort: to.Ptr[int32](0),
EnableFloatingIP: to.Ptr(true),
FrontendIPConfiguration: &armnetwork.SubResource{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
},
FrontendPort: to.Ptr[int32](0),
IdleTimeoutInMinutes: to.Ptr[int32](15),
LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault),
Probe: &armnetwork.SubResource{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"),
},
Protocol: to.Ptr(armnetwork.TransportProtocolAll),
},
}},
OutboundRules: []*armnetwork.OutboundRule{},
Probes: []*armnetwork.Probe{
{
Name: to.Ptr("probe-lb"),
Properties: &armnetwork.ProbePropertiesFormat{
IntervalInSeconds: to.Ptr[int32](15),
NumberOfProbes: to.Ptr[int32](2),
Port: to.Ptr[int32](80),
ProbeThreshold: to.Ptr[int32](1),
RequestPath: to.Ptr("healthcheck.aspx"),
Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP),
},
}},
},
SKU: &armnetwork.LoadBalancerSKU{
Name: to.Ptr(armnetwork.LoadBalancerSKUNameGateway),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.LoadBalancer = armnetwork.LoadBalancer{
// Name: to.Ptr("lb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb"),
// Location: to.Ptr("eastus"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.LoadBalancerPropertiesFormat{
// BackendAddressPools: []*armnetwork.BackendAddressPool{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb1"),
// Name: to.Ptr("be-lb1"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/backendAddressPools"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.BackendAddressPoolPropertiesFormat{
// LoadBalancingRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"),
// }},
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// TunnelInterfaces: []*armnetwork.GatewayLoadBalancerTunnelInterface{
// {
// Type: to.Ptr(armnetwork.GatewayLoadBalancerTunnelInterfaceTypeInternal),
// Identifier: to.Ptr[int32](900),
// Port: to.Ptr[int32](15000),
// Protocol: to.Ptr(armnetwork.GatewayLoadBalancerTunnelProtocolVXLAN),
// }},
// },
// },
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb2"),
// Name: to.Ptr("be-lb2"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/backendAddressPools"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.BackendAddressPoolPropertiesFormat{
// LoadBalancingRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"),
// }},
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// TunnelInterfaces: []*armnetwork.GatewayLoadBalancerTunnelInterface{
// {
// Type: to.Ptr(armnetwork.GatewayLoadBalancerTunnelInterfaceTypeInternal),
// Identifier: to.Ptr[int32](901),
// Port: to.Ptr[int32](15001),
// Protocol: to.Ptr(armnetwork.GatewayLoadBalancerTunnelProtocolVXLAN),
// }},
// },
// }},
// FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
// Name: to.Ptr("fe-lb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/frontendIPConfigurations"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{
// InboundNatRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"),
// }},
// LoadBalancingRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"),
// }},
// PrivateIPAddress: to.Ptr("10.0.1.4"),
// PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic),
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// Subnet: &armnetwork.Subnet{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"),
// },
// },
// }},
// InboundNatPools: []*armnetwork.InboundNatPool{
// },
// LoadBalancingRules: []*armnetwork.LoadBalancingRule{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"),
// Name: to.Ptr("rulelb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/loadBalancingRules"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.LoadBalancingRulePropertiesFormat{
// BackendAddressPools: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb1"),
// },
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb2"),
// }},
// BackendPort: to.Ptr[int32](0),
// DisableOutboundSnat: to.Ptr(false),
// EnableFloatingIP: to.Ptr(true),
// FrontendIPConfiguration: &armnetwork.SubResource{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
// },
// FrontendPort: to.Ptr[int32](0),
// IdleTimeoutInMinutes: to.Ptr[int32](15),
// LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault),
// Probe: &armnetwork.SubResource{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"),
// },
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// Protocol: to.Ptr(armnetwork.TransportProtocolTCP),
// },
// }},
// OutboundRules: []*armnetwork.OutboundRule{
// },
// Probes: []*armnetwork.Probe{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"),
// Name: to.Ptr("probe-lb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/probes"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.ProbePropertiesFormat{
// IntervalInSeconds: to.Ptr[int32](15),
// LoadBalancingRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"),
// }},
// NumberOfProbes: to.Ptr[int32](2),
// Port: to.Ptr[int32](80),
// ProbeThreshold: to.Ptr[int32](1),
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// RequestPath: to.Ptr("healthcheck.aspx"),
// Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP),
// },
// }},
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"),
// },
// SKU: &armnetwork.LoadBalancerSKU{
// Name: to.Ptr(armnetwork.LoadBalancerSKUNameGateway),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { NetworkManagementClient } = require("@azure/arm-network");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates a load balancer.
*
* @summary Creates or updates a load balancer.
* x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateGatewayLoadBalancerProviderWithTwoBackendPool.json
*/
async function createLoadBalancerWithGatewayLoadBalancerProviderConfiguredWithTwoBackendPool() {
const subscriptionId = process.env["NETWORK_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["NETWORK_RESOURCE_GROUP"] || "rg1";
const loadBalancerName = "lb";
const parameters = {
backendAddressPools: [{ name: "be-lb1" }, { name: "be-lb2" }],
frontendIPConfigurations: [
{
name: "fe-lb",
subnet: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb",
},
},
],
inboundNatPools: [],
loadBalancingRules: [
{
name: "rulelb",
backendAddressPool: {},
backendAddressPools: [
{
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb1",
},
{
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb2",
},
],
backendPort: 0,
enableFloatingIP: true,
frontendIPConfiguration: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb",
},
frontendPort: 0,
idleTimeoutInMinutes: 15,
loadDistribution: "Default",
probe: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb",
},
protocol: "All",
},
],
location: "eastus",
outboundRules: [],
probes: [
{
name: "probe-lb",
intervalInSeconds: 15,
numberOfProbes: 2,
port: 80,
probeThreshold: 1,
requestPath: "healthcheck.aspx",
protocol: "Http",
},
],
sku: { name: "Gateway" },
};
const credential = new DefaultAzureCredential();
const client = new NetworkManagementClient(credential, subscriptionId);
const result = await client.loadBalancers.beginCreateOrUpdateAndWait(
resourceGroupName,
loadBalancerName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Network.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Resources.Models;
using Azure.ResourceManager.Network;
// Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateGatewayLoadBalancerProviderWithTwoBackendPool.json
// this example is just showing the usage of "LoadBalancers_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this LoadBalancerResource
LoadBalancerCollection collection = resourceGroupResource.GetLoadBalancers();
// invoke the operation
string loadBalancerName = "lb";
LoadBalancerData data = new LoadBalancerData
{
Sku = new LoadBalancerSku
{
Name = LoadBalancerSkuName.Gateway,
},
FrontendIPConfigurations = {new FrontendIPConfigurationData
{
Subnet = new SubnetData
{
Id = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"),
},
Name = "fe-lb",
}},
BackendAddressPools = {new BackendAddressPoolData
{
Name = "be-lb1",
}, new BackendAddressPoolData
{
Name = "be-lb2",
}},
LoadBalancingRules = {new LoadBalancingRuleData
{
Properties = new LoadBalancingRuleProperties(LoadBalancingTransportProtocol.All, 0)
{
FrontendIPConfigurationId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
BackendAddressPools = {new WritableSubResource
{
Id = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb1"),
}, new WritableSubResource
{
Id = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb2"),
}},
ProbeId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"),
LoadDistribution = LoadDistribution.Default,
BackendPort = 0,
IdleTimeoutInMinutes = 15,
EnableFloatingIP = true,
},
Name = "rulelb",
}},
Probes = {new ProbeData
{
Protocol = ProbeProtocol.Http,
Port = 80,
IntervalInSeconds = 15,
NumberOfProbes = 2,
ProbeThreshold = 1,
RequestPath = "healthcheck.aspx",
Name = "probe-lb",
}},
InboundNatPools = { },
OutboundRules = { },
Location = new AzureLocation("eastus"),
};
ArmOperation<LoadBalancerResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, loadBalancerName, data);
LoadBalancerResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
LoadBalancerData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"name": "lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb",
"type": "Microsoft.Network/loadBalancers",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"location": "eastus",
"sku": {
"name": "Gateway"
},
"properties": {
"provisioningState": "Succeeded",
"resourceGuid": "00000000-0000-0000-0000-00000000",
"frontendIPConfigurations": [
{
"name": "fe-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb",
"type": "Microsoft.Network/loadBalancers/frontendIPConfigurations",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"privateIPAddress": "10.0.1.4",
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"
},
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
],
"inboundNatRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"
}
]
}
}
],
"backendAddressPools": [
{
"name": "be-lb1",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb1",
"type": "Microsoft.Network/loadBalancers/backendAddressPools",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"tunnelInterfaces": [
{
"port": 15000,
"identifier": 900,
"protocol": "VXLAN",
"type": "Internal"
}
],
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
},
{
"name": "be-lb2",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb2",
"type": "Microsoft.Network/loadBalancers/backendAddressPools",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"tunnelInterfaces": [
{
"port": 15001,
"identifier": 901,
"protocol": "VXLAN",
"type": "Internal"
}
],
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
}
],
"loadBalancingRules": [
{
"name": "rulelb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb",
"type": "Microsoft.Network/loadBalancers/loadBalancingRules",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 0,
"backendPort": 0,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp",
"loadDistribution": "Default",
"backendAddressPools": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb1"
},
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb2"
}
],
"probe": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"
},
"disableOutboundSnat": false
}
}
],
"probes": [
{
"name": "probe-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb",
"type": "Microsoft.Network/loadBalancers/probes",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"protocol": "Http",
"port": 80,
"requestPath": "healthcheck.aspx",
"intervalInSeconds": 15,
"numberOfProbes": 2,
"probeThreshold": 1,
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
}
],
"outboundRules": [],
"inboundNatPools": []
}
}
{
"name": "lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb",
"type": "Microsoft.Network/loadBalancers",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"location": "eastus",
"sku": {
"name": "Gateway"
},
"properties": {
"provisioningState": "Succeeded",
"resourceGuid": "00000000-0000-0000-0000-00000000",
"frontendIPConfigurations": [
{
"name": "fe-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb",
"type": "Microsoft.Network/loadBalancers/frontendIPConfigurations",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"privateIPAddress": "10.0.1.4",
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"
},
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
}
],
"backendAddressPools": [
{
"name": "be-lb1",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb1",
"type": "Microsoft.Network/loadBalancers/backendAddressPools",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"tunnelInterfaces": [
{
"port": 15000,
"identifier": 900,
"protocol": "VXLAN",
"type": "Internal"
}
],
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
},
{
"name": "be-lb2",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb2",
"type": "Microsoft.Network/loadBalancers/backendAddressPools",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"tunnelInterfaces": [
{
"port": 15001,
"identifier": 901,
"protocol": "VXLAN",
"type": "Internal"
}
],
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
}
],
"loadBalancingRules": [
{
"name": "rulelb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb",
"type": "Microsoft.Network/loadBalancers/loadBalancingRules",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 80,
"backendPort": 80,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp",
"loadDistribution": "Default",
"backendAddressPools": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb1"
},
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb2"
}
],
"probe": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"
},
"disableOutboundSnat": false
}
}
],
"probes": [
{
"name": "probe-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb",
"type": "Microsoft.Network/loadBalancers/probes",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"protocol": "Http",
"port": 80,
"requestPath": "healthcheck.aspx",
"intervalInSeconds": 15,
"numberOfProbes": 2,
"probeThreshold": 1,
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
}
],
"outboundRules": [],
"inboundNatPools": []
}
}
Create load balancer with Global Tier and one regional load balancer in its backend pool
要求のサンプル
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb?api-version=2024-05-01
{
"location": "eastus",
"sku": {
"name": "Standard",
"tier": "Global"
},
"properties": {
"frontendIPConfigurations": [
{
"name": "fe-lb",
"properties": {
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"
}
}
}
],
"backendAddressPools": [
{
"name": "be-lb",
"properties": {
"loadBalancerBackendAddresses": [
{
"name": "regional-lb1-address",
"properties": {
"loadBalancerFrontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/regional-lb-rg1/providers/Microsoft.Network/loadBalancers/regional-lb/frontendIPConfigurations/fe-rlb"
}
}
}
]
}
}
],
"loadBalancingRules": [
{
"name": "rulelb",
"properties": {
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 80,
"backendPort": 80,
"enableFloatingIP": false,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp",
"loadDistribution": "Default",
"backendAddressPool": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"
},
"probe": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"
}
}
}
],
"probes": [
{
"name": "probe-lb",
"properties": {
"protocol": "Http",
"port": 80,
"requestPath": "healthcheck.aspx",
"intervalInSeconds": 15,
"numberOfProbes": 2,
"probeThreshold": 1
}
}
]
}
}
import com.azure.core.management.SubResource;
import com.azure.resourcemanager.network.fluent.models.BackendAddressPoolInner;
import com.azure.resourcemanager.network.fluent.models.FrontendIpConfigurationInner;
import com.azure.resourcemanager.network.fluent.models.LoadBalancerInner;
import com.azure.resourcemanager.network.fluent.models.LoadBalancingRuleInner;
import com.azure.resourcemanager.network.fluent.models.ProbeInner;
import com.azure.resourcemanager.network.fluent.models.SubnetInner;
import com.azure.resourcemanager.network.models.LoadBalancerBackendAddress;
import com.azure.resourcemanager.network.models.LoadBalancerSku;
import com.azure.resourcemanager.network.models.LoadBalancerSkuName;
import com.azure.resourcemanager.network.models.LoadBalancerSkuTier;
import com.azure.resourcemanager.network.models.LoadDistribution;
import com.azure.resourcemanager.network.models.ProbeProtocol;
import com.azure.resourcemanager.network.models.TransportProtocol;
import java.util.Arrays;
/**
* Samples for LoadBalancers CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateGlobalTier.
* json
*/
/**
* Sample code: Create load balancer with Global Tier and one regional load balancer in its backend pool.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createLoadBalancerWithGlobalTierAndOneRegionalLoadBalancerInItsBackendPool(
com.azure.resourcemanager.AzureResourceManager azure) {
azure.networks().manager().serviceClient().getLoadBalancers().createOrUpdate("rg1", "lb",
new LoadBalancerInner().withLocation("eastus")
.withSku(
new LoadBalancerSku().withName(LoadBalancerSkuName.STANDARD).withTier(LoadBalancerSkuTier.GLOBAL))
.withFrontendIpConfigurations(Arrays.asList(new FrontendIpConfigurationInner().withName("fe-lb")
.withSubnet(new SubnetInner().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"))))
.withBackendAddressPools(Arrays.asList(new BackendAddressPoolInner().withName("be-lb")
.withLoadBalancerBackendAddresses(Arrays.asList(new LoadBalancerBackendAddress()
.withName("regional-lb1-address")
.withLoadBalancerFrontendIpConfiguration(new SubResource().withId(
"/subscriptions/subid/resourceGroups/regional-lb-rg1/providers/Microsoft.Network/loadBalancers/regional-lb/frontendIPConfigurations/fe-rlb"))))))
.withLoadBalancingRules(Arrays.asList(new LoadBalancingRuleInner().withName("rulelb")
.withFrontendIpConfiguration(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"))
.withBackendAddressPool(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"))
.withProbe(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"))
.withProtocol(TransportProtocol.TCP).withLoadDistribution(LoadDistribution.DEFAULT)
.withFrontendPort(80).withBackendPort(80).withIdleTimeoutInMinutes(15).withEnableFloatingIp(false)))
.withProbes(Arrays.asList(new ProbeInner().withName("probe-lb").withProtocol(ProbeProtocol.HTTP)
.withPort(80).withIntervalInSeconds(15).withNumberOfProbes(2).withProbeThreshold(1)
.withRequestPath("healthcheck.aspx"))),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.network import NetworkManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-network
# USAGE
python load_balancer_create_global_tier.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = NetworkManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.load_balancers.begin_create_or_update(
resource_group_name="rg1",
load_balancer_name="lb",
parameters={
"location": "eastus",
"properties": {
"backendAddressPools": [
{
"name": "be-lb",
"properties": {
"loadBalancerBackendAddresses": [
{
"name": "regional-lb1-address",
"properties": {
"loadBalancerFrontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/regional-lb-rg1/providers/Microsoft.Network/loadBalancers/regional-lb/frontendIPConfigurations/fe-rlb"
}
},
}
]
},
}
],
"frontendIPConfigurations": [
{
"name": "fe-lb",
"properties": {
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"
}
},
}
],
"loadBalancingRules": [
{
"name": "rulelb",
"properties": {
"backendAddressPool": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"
},
"backendPort": 80,
"enableFloatingIP": False,
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 80,
"idleTimeoutInMinutes": 15,
"loadDistribution": "Default",
"probe": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"
},
"protocol": "Tcp",
},
}
],
"probes": [
{
"name": "probe-lb",
"properties": {
"intervalInSeconds": 15,
"numberOfProbes": 2,
"port": 80,
"probeThreshold": 1,
"protocol": "Http",
"requestPath": "healthcheck.aspx",
},
}
],
},
"sku": {"name": "Standard", "tier": "Global"},
},
).result()
print(response)
# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateGlobalTier.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armnetwork_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ab04533261eff228f28e08900445d0edef3eb70c/specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateGlobalTier.json
func ExampleLoadBalancersClient_BeginCreateOrUpdate_createLoadBalancerWithGlobalTierAndOneRegionalLoadBalancerInItsBackendPool() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armnetwork.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewLoadBalancersClient().BeginCreateOrUpdate(ctx, "rg1", "lb", armnetwork.LoadBalancer{
Location: to.Ptr("eastus"),
Properties: &armnetwork.LoadBalancerPropertiesFormat{
BackendAddressPools: []*armnetwork.BackendAddressPool{
{
Name: to.Ptr("be-lb"),
Properties: &armnetwork.BackendAddressPoolPropertiesFormat{
LoadBalancerBackendAddresses: []*armnetwork.LoadBalancerBackendAddress{
{
Name: to.Ptr("regional-lb1-address"),
Properties: &armnetwork.LoadBalancerBackendAddressPropertiesFormat{
LoadBalancerFrontendIPConfiguration: &armnetwork.SubResource{
ID: to.Ptr("/subscriptions/subid/resourceGroups/regional-lb-rg1/providers/Microsoft.Network/loadBalancers/regional-lb/frontendIPConfigurations/fe-rlb"),
},
},
}},
},
}},
FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{
{
Name: to.Ptr("fe-lb"),
Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{
Subnet: &armnetwork.Subnet{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"),
},
},
}},
LoadBalancingRules: []*armnetwork.LoadBalancingRule{
{
Name: to.Ptr("rulelb"),
Properties: &armnetwork.LoadBalancingRulePropertiesFormat{
BackendAddressPool: &armnetwork.SubResource{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"),
},
BackendPort: to.Ptr[int32](80),
EnableFloatingIP: to.Ptr(false),
FrontendIPConfiguration: &armnetwork.SubResource{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
},
FrontendPort: to.Ptr[int32](80),
IdleTimeoutInMinutes: to.Ptr[int32](15),
LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault),
Probe: &armnetwork.SubResource{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"),
},
Protocol: to.Ptr(armnetwork.TransportProtocolTCP),
},
}},
Probes: []*armnetwork.Probe{
{
Name: to.Ptr("probe-lb"),
Properties: &armnetwork.ProbePropertiesFormat{
IntervalInSeconds: to.Ptr[int32](15),
NumberOfProbes: to.Ptr[int32](2),
Port: to.Ptr[int32](80),
ProbeThreshold: to.Ptr[int32](1),
RequestPath: to.Ptr("healthcheck.aspx"),
Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP),
},
}},
},
SKU: &armnetwork.LoadBalancerSKU{
Name: to.Ptr(armnetwork.LoadBalancerSKUNameStandard),
Tier: to.Ptr(armnetwork.LoadBalancerSKUTierGlobal),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.LoadBalancer = armnetwork.LoadBalancer{
// Name: to.Ptr("lb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb"),
// Location: to.Ptr("eastus"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.LoadBalancerPropertiesFormat{
// BackendAddressPools: []*armnetwork.BackendAddressPool{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"),
// Name: to.Ptr("be-lb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/backendAddressPools"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.BackendAddressPoolPropertiesFormat{
// LoadBalancerBackendAddresses: []*armnetwork.LoadBalancerBackendAddress{
// {
// Name: to.Ptr("regional-lb1-address"),
// Properties: &armnetwork.LoadBalancerBackendAddressPropertiesFormat{
// LoadBalancerFrontendIPConfiguration: &armnetwork.SubResource{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/regional-lb-rg1/providers/Microsoft.Network/loadBalancers/regional-lb/frontendIPConfigurations/fe-rlb"),
// },
// },
// }},
// LoadBalancingRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"),
// }},
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// },
// }},
// FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
// Name: to.Ptr("fe-lb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/frontendIPConfigurations"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{
// InboundNatRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"),
// }},
// LoadBalancingRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"),
// }},
// PrivateIPAddress: to.Ptr("10.0.1.4"),
// PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic),
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// Subnet: &armnetwork.Subnet{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"),
// },
// },
// }},
// LoadBalancingRules: []*armnetwork.LoadBalancingRule{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"),
// Name: to.Ptr("rulelb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/loadBalancingRules"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.LoadBalancingRulePropertiesFormat{
// BackendAddressPool: &armnetwork.SubResource{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"),
// },
// BackendPort: to.Ptr[int32](80),
// DisableOutboundSnat: to.Ptr(false),
// EnableFloatingIP: to.Ptr(false),
// FrontendIPConfiguration: &armnetwork.SubResource{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
// },
// FrontendPort: to.Ptr[int32](80),
// IdleTimeoutInMinutes: to.Ptr[int32](15),
// LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault),
// Probe: &armnetwork.SubResource{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"),
// },
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// Protocol: to.Ptr(armnetwork.TransportProtocolTCP),
// },
// }},
// Probes: []*armnetwork.Probe{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"),
// Name: to.Ptr("probe-lb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/probes"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.ProbePropertiesFormat{
// IntervalInSeconds: to.Ptr[int32](15),
// LoadBalancingRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"),
// }},
// NumberOfProbes: to.Ptr[int32](2),
// Port: to.Ptr[int32](80),
// ProbeThreshold: to.Ptr[int32](1),
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// RequestPath: to.Ptr("healthcheck.aspx"),
// Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP),
// },
// }},
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"),
// },
// SKU: &armnetwork.LoadBalancerSKU{
// Name: to.Ptr(armnetwork.LoadBalancerSKUNameStandard),
// Tier: to.Ptr(armnetwork.LoadBalancerSKUTierGlobal),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { NetworkManagementClient } = require("@azure/arm-network");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates a load balancer.
*
* @summary Creates or updates a load balancer.
* x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateGlobalTier.json
*/
async function createLoadBalancerWithGlobalTierAndOneRegionalLoadBalancerInItsBackendPool() {
const subscriptionId = process.env["NETWORK_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["NETWORK_RESOURCE_GROUP"] || "rg1";
const loadBalancerName = "lb";
const parameters = {
backendAddressPools: [
{
name: "be-lb",
loadBalancerBackendAddresses: [
{
name: "regional-lb1-address",
loadBalancerFrontendIPConfiguration: {
id: "/subscriptions/subid/resourceGroups/regional-lb-rg1/providers/Microsoft.Network/loadBalancers/regional-lb/frontendIPConfigurations/fe-rlb",
},
},
],
},
],
frontendIPConfigurations: [
{
name: "fe-lb",
subnet: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb",
},
},
],
loadBalancingRules: [
{
name: "rulelb",
backendAddressPool: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb",
},
backendPort: 80,
enableFloatingIP: false,
frontendIPConfiguration: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb",
},
frontendPort: 80,
idleTimeoutInMinutes: 15,
loadDistribution: "Default",
probe: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb",
},
protocol: "Tcp",
},
],
location: "eastus",
probes: [
{
name: "probe-lb",
intervalInSeconds: 15,
numberOfProbes: 2,
port: 80,
probeThreshold: 1,
requestPath: "healthcheck.aspx",
protocol: "Http",
},
],
sku: { name: "Standard", tier: "Global" },
};
const credential = new DefaultAzureCredential();
const client = new NetworkManagementClient(credential, subscriptionId);
const result = await client.loadBalancers.beginCreateOrUpdateAndWait(
resourceGroupName,
loadBalancerName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Network.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Resources.Models;
using Azure.ResourceManager.Network;
// Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateGlobalTier.json
// this example is just showing the usage of "LoadBalancers_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this LoadBalancerResource
LoadBalancerCollection collection = resourceGroupResource.GetLoadBalancers();
// invoke the operation
string loadBalancerName = "lb";
LoadBalancerData data = new LoadBalancerData
{
Sku = new LoadBalancerSku
{
Name = LoadBalancerSkuName.Standard,
Tier = LoadBalancerSkuTier.Global,
},
FrontendIPConfigurations = {new FrontendIPConfigurationData
{
Subnet = new SubnetData
{
Id = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"),
},
Name = "fe-lb",
}},
BackendAddressPools = {new BackendAddressPoolData
{
LoadBalancerBackendAddresses = {new LoadBalancerBackendAddress
{
Name = "regional-lb1-address",
LoadBalancerFrontendIPConfigurationId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/regional-lb-rg1/providers/Microsoft.Network/loadBalancers/regional-lb/frontendIPConfigurations/fe-rlb"),
}},
Name = "be-lb",
}},
LoadBalancingRules = {new LoadBalancingRuleData
{
Properties = new LoadBalancingRuleProperties(LoadBalancingTransportProtocol.Tcp, 80)
{
FrontendIPConfigurationId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
BackendAddressPoolId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"),
ProbeId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"),
LoadDistribution = LoadDistribution.Default,
BackendPort = 80,
IdleTimeoutInMinutes = 15,
EnableFloatingIP = false,
},
Name = "rulelb",
}},
Probes = {new ProbeData
{
Protocol = ProbeProtocol.Http,
Port = 80,
IntervalInSeconds = 15,
NumberOfProbes = 2,
ProbeThreshold = 1,
RequestPath = "healthcheck.aspx",
Name = "probe-lb",
}},
Location = new AzureLocation("eastus"),
};
ArmOperation<LoadBalancerResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, loadBalancerName, data);
LoadBalancerResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
LoadBalancerData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"name": "lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb",
"type": "Microsoft.Network/loadBalancers",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"location": "eastus",
"sku": {
"name": "Standard",
"tier": "Global"
},
"properties": {
"provisioningState": "Succeeded",
"resourceGuid": "00000000-0000-0000-0000-00000000",
"frontendIPConfigurations": [
{
"name": "fe-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb",
"type": "Microsoft.Network/loadBalancers/frontendIPConfigurations",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"privateIPAddress": "10.0.1.4",
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"
},
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
],
"inboundNatRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"
}
]
}
}
],
"backendAddressPools": [
{
"name": "be-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb",
"type": "Microsoft.Network/loadBalancers/backendAddressPools",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"loadBalancerBackendAddresses": [
{
"name": "regional-lb1-address",
"properties": {
"loadBalancerFrontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/regional-lb-rg1/providers/Microsoft.Network/loadBalancers/regional-lb/frontendIPConfigurations/fe-rlb"
}
}
}
],
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
}
],
"loadBalancingRules": [
{
"name": "rulelb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb",
"type": "Microsoft.Network/loadBalancers/loadBalancingRules",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 80,
"backendPort": 80,
"enableFloatingIP": false,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp",
"loadDistribution": "Default",
"backendAddressPool": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"
},
"probe": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"
},
"disableOutboundSnat": false
}
}
],
"probes": [
{
"name": "probe-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb",
"type": "Microsoft.Network/loadBalancers/probes",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"protocol": "Http",
"port": 80,
"requestPath": "healthcheck.aspx",
"intervalInSeconds": 15,
"numberOfProbes": 2,
"probeThreshold": 1,
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
}
]
}
}
{
"name": "lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb",
"type": "Microsoft.Network/loadBalancers",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"location": "eastus",
"sku": {
"name": "Standard",
"tier": "Global"
},
"properties": {
"provisioningState": "Succeeded",
"resourceGuid": "00000000-0000-0000-0000-00000000",
"frontendIPConfigurations": [
{
"name": "fe-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb",
"type": "Microsoft.Network/loadBalancers/frontendIPConfigurations",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"privateIPAddress": "10.0.1.4",
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"
},
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
],
"inboundNatRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"
}
]
}
}
],
"backendAddressPools": [
{
"name": "be-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb",
"type": "Microsoft.Network/loadBalancers/backendAddressPools",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"loadBalancerBackendAddresses": [
{
"name": "regional-lb1-address",
"properties": {
"loadBalancerFrontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/regional-lb-rg1/providers/Microsoft.Network/loadBalancers/regional-lb/frontendIPConfigurations/fe-rlb"
}
}
}
],
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
}
],
"loadBalancingRules": [
{
"name": "rulelb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb",
"type": "Microsoft.Network/loadBalancers/loadBalancingRules",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 80,
"backendPort": 80,
"enableFloatingIP": false,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp",
"loadDistribution": "Default",
"backendAddressPool": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"
},
"probe": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"
},
"disableOutboundSnat": false
}
}
],
"probes": [
{
"name": "probe-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb",
"type": "Microsoft.Network/loadBalancers/probes",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"protocol": "Http",
"port": 80,
"requestPath": "healthcheck.aspx",
"intervalInSeconds": 15,
"numberOfProbes": 2,
"probeThreshold": 1,
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
}
]
}
}
Create load balancer with inbound nat pool
要求のサンプル
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb?api-version=2024-05-01
{
"location": "eastus",
"sku": {
"name": "Standard"
},
"properties": {
"frontendIPConfigurations": [
{
"properties": {
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/lbvnet/subnets/lbsubnet"
}
},
"name": "test",
"zones": [],
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/test"
}
],
"backendAddressPools": [],
"loadBalancingRules": [],
"probes": [],
"inboundNatRules": [],
"outboundRules": [],
"inboundNatPools": [
{
"properties": {
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/test"
},
"protocol": "Tcp",
"frontendPortRangeStart": 8080,
"frontendPortRangeEnd": 8085,
"backendPort": 8888,
"idleTimeoutInMinutes": 10,
"enableFloatingIP": true,
"enableTcpReset": true
},
"name": "test",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatPools/test"
}
]
}
}
import com.azure.core.management.SubResource;
import com.azure.resourcemanager.network.fluent.models.FrontendIpConfigurationInner;
import com.azure.resourcemanager.network.fluent.models.LoadBalancerInner;
import com.azure.resourcemanager.network.fluent.models.SubnetInner;
import com.azure.resourcemanager.network.models.InboundNatPool;
import com.azure.resourcemanager.network.models.IpAllocationMethod;
import com.azure.resourcemanager.network.models.LoadBalancerSku;
import com.azure.resourcemanager.network.models.LoadBalancerSkuName;
import com.azure.resourcemanager.network.models.TransportProtocol;
import java.util.Arrays;
/**
* Samples for LoadBalancers CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/
* LoadBalancerCreateWithInboundNatPool.json
*/
/**
* Sample code: Create load balancer with inbound nat pool.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createLoadBalancerWithInboundNatPool(com.azure.resourcemanager.AzureResourceManager azure) {
azure.networks().manager().serviceClient().getLoadBalancers().createOrUpdate("rg1", "lb",
new LoadBalancerInner().withLocation("eastus")
.withSku(new LoadBalancerSku().withName(LoadBalancerSkuName.STANDARD))
.withFrontendIpConfigurations(Arrays.asList(new FrontendIpConfigurationInner().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/test")
.withName("test").withZones(Arrays.asList())
.withPrivateIpAllocationMethod(IpAllocationMethod.DYNAMIC)
.withSubnet(new SubnetInner().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/lbvnet/subnets/lbsubnet"))))
.withBackendAddressPools(Arrays.asList()).withLoadBalancingRules(Arrays.asList())
.withProbes(Arrays.asList()).withInboundNatRules(Arrays.asList())
.withInboundNatPools(Arrays.asList(new InboundNatPool().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatPools/test")
.withName("test")
.withFrontendIpConfiguration(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/test"))
.withProtocol(TransportProtocol.TCP).withFrontendPortRangeStart(8080).withFrontendPortRangeEnd(8085)
.withBackendPort(8888).withIdleTimeoutInMinutes(10).withEnableFloatingIp(true)
.withEnableTcpReset(true)))
.withOutboundRules(Arrays.asList()),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.network import NetworkManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-network
# USAGE
python load_balancer_create_with_inbound_nat_pool.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = NetworkManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.load_balancers.begin_create_or_update(
resource_group_name="rg1",
load_balancer_name="lb",
parameters={
"location": "eastus",
"properties": {
"backendAddressPools": [],
"frontendIPConfigurations": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/test",
"name": "test",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/lbvnet/subnets/lbsubnet"
},
},
"zones": [],
}
],
"inboundNatPools": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatPools/test",
"name": "test",
"properties": {
"backendPort": 8888,
"enableFloatingIP": True,
"enableTcpReset": True,
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/test"
},
"frontendPortRangeEnd": 8085,
"frontendPortRangeStart": 8080,
"idleTimeoutInMinutes": 10,
"protocol": "Tcp",
},
}
],
"inboundNatRules": [],
"loadBalancingRules": [],
"outboundRules": [],
"probes": [],
},
"sku": {"name": "Standard"},
},
).result()
print(response)
# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateWithInboundNatPool.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armnetwork_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ab04533261eff228f28e08900445d0edef3eb70c/specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateWithInboundNatPool.json
func ExampleLoadBalancersClient_BeginCreateOrUpdate_createLoadBalancerWithInboundNatPool() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armnetwork.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewLoadBalancersClient().BeginCreateOrUpdate(ctx, "rg1", "lb", armnetwork.LoadBalancer{
Location: to.Ptr("eastus"),
Properties: &armnetwork.LoadBalancerPropertiesFormat{
BackendAddressPools: []*armnetwork.BackendAddressPool{},
FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{
{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/test"),
Name: to.Ptr("test"),
Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{
PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic),
Subnet: &armnetwork.Subnet{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/lbvnet/subnets/lbsubnet"),
},
},
Zones: []*string{},
}},
InboundNatPools: []*armnetwork.InboundNatPool{
{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatPools/test"),
Name: to.Ptr("test"),
Properties: &armnetwork.InboundNatPoolPropertiesFormat{
BackendPort: to.Ptr[int32](8888),
EnableFloatingIP: to.Ptr(true),
EnableTCPReset: to.Ptr(true),
FrontendIPConfiguration: &armnetwork.SubResource{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/test"),
},
FrontendPortRangeEnd: to.Ptr[int32](8085),
FrontendPortRangeStart: to.Ptr[int32](8080),
IdleTimeoutInMinutes: to.Ptr[int32](10),
Protocol: to.Ptr(armnetwork.TransportProtocolTCP),
},
}},
InboundNatRules: []*armnetwork.InboundNatRule{},
LoadBalancingRules: []*armnetwork.LoadBalancingRule{},
OutboundRules: []*armnetwork.OutboundRule{},
Probes: []*armnetwork.Probe{},
},
SKU: &armnetwork.LoadBalancerSKU{
Name: to.Ptr(armnetwork.LoadBalancerSKUNameStandard),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.LoadBalancer = armnetwork.LoadBalancer{
// Name: to.Ptr("lb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb"),
// Location: to.Ptr("eastus"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.LoadBalancerPropertiesFormat{
// BackendAddressPools: []*armnetwork.BackendAddressPool{
// },
// FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/test"),
// Name: to.Ptr("test"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/frontendIPConfigurations"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{
// InboundNatPools: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatPools/test"),
// }},
// PrivateIPAddress: to.Ptr("10.0.1.4"),
// PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic),
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// Subnet: &armnetwork.Subnet{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/lbvnet/subnets/lbsubnet"),
// },
// },
// }},
// InboundNatPools: []*armnetwork.InboundNatPool{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatPools/test"),
// Name: to.Ptr("test"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/inboundNatPools"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.InboundNatPoolPropertiesFormat{
// BackendPort: to.Ptr[int32](8888),
// EnableFloatingIP: to.Ptr(true),
// EnableTCPReset: to.Ptr(true),
// FrontendIPConfiguration: &armnetwork.SubResource{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/test"),
// },
// FrontendPortRangeEnd: to.Ptr[int32](8085),
// FrontendPortRangeStart: to.Ptr[int32](8080),
// IdleTimeoutInMinutes: to.Ptr[int32](10),
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// Protocol: to.Ptr(armnetwork.TransportProtocolTCP),
// },
// }},
// InboundNatRules: []*armnetwork.InboundNatRule{
// },
// LoadBalancingRules: []*armnetwork.LoadBalancingRule{
// },
// OutboundRules: []*armnetwork.OutboundRule{
// },
// Probes: []*armnetwork.Probe{
// },
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"),
// },
// SKU: &armnetwork.LoadBalancerSKU{
// Name: to.Ptr(armnetwork.LoadBalancerSKUNameStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { NetworkManagementClient } = require("@azure/arm-network");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates a load balancer.
*
* @summary Creates or updates a load balancer.
* x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateWithInboundNatPool.json
*/
async function createLoadBalancerWithInboundNatPool() {
const subscriptionId = process.env["NETWORK_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["NETWORK_RESOURCE_GROUP"] || "rg1";
const loadBalancerName = "lb";
const parameters = {
backendAddressPools: [],
frontendIPConfigurations: [
{
name: "test",
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/test",
privateIPAllocationMethod: "Dynamic",
subnet: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/lbvnet/subnets/lbsubnet",
},
zones: [],
},
],
inboundNatPools: [
{
name: "test",
backendPort: 8888,
enableFloatingIP: true,
enableTcpReset: true,
frontendIPConfiguration: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/test",
},
frontendPortRangeEnd: 8085,
frontendPortRangeStart: 8080,
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatPools/test",
idleTimeoutInMinutes: 10,
protocol: "Tcp",
},
],
inboundNatRules: [],
loadBalancingRules: [],
location: "eastus",
outboundRules: [],
probes: [],
sku: { name: "Standard" },
};
const credential = new DefaultAzureCredential();
const client = new NetworkManagementClient(credential, subscriptionId);
const result = await client.loadBalancers.beginCreateOrUpdateAndWait(
resourceGroupName,
loadBalancerName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Network.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Resources.Models;
using Azure.ResourceManager.Network;
// Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateWithInboundNatPool.json
// this example is just showing the usage of "LoadBalancers_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this LoadBalancerResource
LoadBalancerCollection collection = resourceGroupResource.GetLoadBalancers();
// invoke the operation
string loadBalancerName = "lb";
LoadBalancerData data = new LoadBalancerData
{
Sku = new LoadBalancerSku
{
Name = LoadBalancerSkuName.Standard,
},
FrontendIPConfigurations = {new FrontendIPConfigurationData
{
Zones = {},
PrivateIPAllocationMethod = NetworkIPAllocationMethod.Dynamic,
Subnet = new SubnetData
{
Id = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/lbvnet/subnets/lbsubnet"),
},
Id = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/test"),
Name = "test",
}},
BackendAddressPools = { },
LoadBalancingRules = { },
Probes = { },
InboundNatRules = { },
InboundNatPools = {new LoadBalancerInboundNatPool
{
Properties = new LoadBalancerInboundNatPoolProperties(LoadBalancingTransportProtocol.Tcp, 8080, 8085, 8888)
{
FrontendIPConfigurationId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/test"),
IdleTimeoutInMinutes = 10,
EnableFloatingIP = true,
EnableTcpReset = true,
},
Id = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatPools/test"),
Name = "test",
}},
OutboundRules = { },
Location = new AzureLocation("eastus"),
};
ArmOperation<LoadBalancerResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, loadBalancerName, data);
LoadBalancerResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
LoadBalancerData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"name": "lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb",
"type": "Microsoft.Network/loadBalancers",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"location": "eastus",
"sku": {
"name": "Standard"
},
"properties": {
"provisioningState": "Succeeded",
"resourceGuid": "00000000-0000-0000-0000-00000000",
"frontendIPConfigurations": [
{
"name": "test",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/test",
"type": "Microsoft.Network/loadBalancers/frontendIPConfigurations",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"privateIPAddress": "10.0.1.4",
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/lbvnet/subnets/lbsubnet"
},
"inboundNatPools": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatPools/test"
}
]
}
}
],
"backendAddressPools": [],
"loadBalancingRules": [],
"probes": [],
"inboundNatRules": [],
"outboundRules": [],
"inboundNatPools": [
{
"name": "test",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatPools/test",
"type": "Microsoft.Network/loadBalancers/inboundNatPools",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"frontendPortRangeStart": 8080,
"frontendPortRangeEnd": 8085,
"backendPort": 8888,
"idleTimeoutInMinutes": 10,
"enableFloatingIP": true,
"protocol": "Tcp",
"enableTcpReset": true,
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/test"
}
}
}
]
}
}
{
"name": "lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb",
"type": "Microsoft.Network/loadBalancers",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"location": "eastus",
"sku": {
"name": "Standard"
},
"properties": {
"provisioningState": "Succeeded",
"resourceGuid": "00000000-0000-0000-0000-00000000",
"frontendIPConfigurations": [
{
"name": "test",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/test",
"type": "Microsoft.Network/loadBalancers/frontendIPConfigurations",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"privateIPAddress": "10.0.1.4",
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/lbvnet/subnets/lbsubnet"
},
"inboundNatPools": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatPools/test"
}
]
}
}
],
"backendAddressPools": [],
"loadBalancingRules": [],
"probes": [],
"inboundNatRules": [],
"outboundRules": [],
"inboundNatPools": [
{
"name": "test",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatPools/test",
"type": "Microsoft.Network/loadBalancers/inboundNatPools",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"frontendPortRangeStart": 8080,
"frontendPortRangeEnd": 8085,
"backendPort": 8888,
"idleTimeoutInMinutes": 10,
"enableFloatingIP": true,
"protocol": "Tcp",
"enableTcpReset": true,
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/test"
}
}
}
]
}
}
Create load balancer with outbound rules
要求のサンプル
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb?api-version=2024-05-01
{
"location": "eastus",
"sku": {
"name": "Standard"
},
"properties": {
"frontendIPConfigurations": [
{
"name": "fe-lb",
"properties": {
"publicIPAddress": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pip"
}
}
}
],
"backendAddressPools": [
{
"name": "be-lb",
"properties": {}
}
],
"loadBalancingRules": [
{
"name": "rulelb",
"properties": {
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"backendAddressPool": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"
},
"probe": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"
},
"protocol": "Tcp",
"loadDistribution": "Default",
"frontendPort": 80,
"backendPort": 80,
"idleTimeoutInMinutes": 15,
"enableFloatingIP": true,
"disableOutboundSnat": true
}
}
],
"probes": [
{
"name": "probe-lb",
"properties": {
"protocol": "Http",
"port": 80,
"requestPath": "healthcheck.aspx",
"intervalInSeconds": 15,
"numberOfProbes": 2,
"probeThreshold": 1
}
}
],
"inboundNatRules": [
{
"name": "in-nat-rule",
"properties": {
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 3389,
"backendPort": 3389,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp"
}
}
],
"inboundNatPools": [],
"outboundRules": [
{
"name": "rule1",
"properties": {
"backendAddressPool": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"
},
"frontendIPConfigurations": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
}
],
"protocol": "All"
}
}
]
}
}
import com.azure.core.management.SubResource;
import com.azure.resourcemanager.network.fluent.models.BackendAddressPoolInner;
import com.azure.resourcemanager.network.fluent.models.FrontendIpConfigurationInner;
import com.azure.resourcemanager.network.fluent.models.InboundNatRuleInner;
import com.azure.resourcemanager.network.fluent.models.LoadBalancerInner;
import com.azure.resourcemanager.network.fluent.models.LoadBalancingRuleInner;
import com.azure.resourcemanager.network.fluent.models.OutboundRuleInner;
import com.azure.resourcemanager.network.fluent.models.ProbeInner;
import com.azure.resourcemanager.network.fluent.models.PublicIpAddressInner;
import com.azure.resourcemanager.network.models.LoadBalancerOutboundRuleProtocol;
import com.azure.resourcemanager.network.models.LoadBalancerSku;
import com.azure.resourcemanager.network.models.LoadBalancerSkuName;
import com.azure.resourcemanager.network.models.LoadDistribution;
import com.azure.resourcemanager.network.models.ProbeProtocol;
import com.azure.resourcemanager.network.models.TransportProtocol;
import java.util.Arrays;
/**
* Samples for LoadBalancers CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/
* LoadBalancerCreateWithOutboundRules.json
*/
/**
* Sample code: Create load balancer with outbound rules.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createLoadBalancerWithOutboundRules(com.azure.resourcemanager.AzureResourceManager azure) {
azure.networks().manager().serviceClient().getLoadBalancers().createOrUpdate("rg1", "lb",
new LoadBalancerInner().withLocation("eastus")
.withSku(new LoadBalancerSku().withName(LoadBalancerSkuName.STANDARD))
.withFrontendIpConfigurations(Arrays.asList(new FrontendIpConfigurationInner().withName("fe-lb")
.withPublicIpAddress(new PublicIpAddressInner().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pip"))))
.withBackendAddressPools(Arrays.asList(new BackendAddressPoolInner().withName("be-lb")))
.withLoadBalancingRules(Arrays.asList(new LoadBalancingRuleInner().withName("rulelb")
.withFrontendIpConfiguration(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"))
.withBackendAddressPool(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"))
.withProbe(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"))
.withProtocol(TransportProtocol.TCP).withLoadDistribution(LoadDistribution.DEFAULT)
.withFrontendPort(80).withBackendPort(80).withIdleTimeoutInMinutes(15).withEnableFloatingIp(true)
.withDisableOutboundSnat(true)))
.withProbes(Arrays.asList(new ProbeInner().withName("probe-lb").withProtocol(ProbeProtocol.HTTP)
.withPort(80).withIntervalInSeconds(15).withNumberOfProbes(2).withProbeThreshold(1)
.withRequestPath("healthcheck.aspx")))
.withInboundNatRules(Arrays.asList(new InboundNatRuleInner().withName("in-nat-rule")
.withFrontendIpConfiguration(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"))
.withProtocol(TransportProtocol.TCP).withFrontendPort(3389).withBackendPort(3389)
.withIdleTimeoutInMinutes(15).withEnableFloatingIp(true)))
.withInboundNatPools(Arrays.asList())
.withOutboundRules(Arrays.asList(new OutboundRuleInner().withName("rule1")
.withFrontendIpConfigurations(Arrays.asList(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb")))
.withBackendAddressPool(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"))
.withProtocol(LoadBalancerOutboundRuleProtocol.ALL))),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.network import NetworkManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-network
# USAGE
python load_balancer_create_with_outbound_rules.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = NetworkManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.load_balancers.begin_create_or_update(
resource_group_name="rg1",
load_balancer_name="lb",
parameters={
"location": "eastus",
"properties": {
"backendAddressPools": [{"name": "be-lb", "properties": {}}],
"frontendIPConfigurations": [
{
"name": "fe-lb",
"properties": {
"publicIPAddress": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pip"
}
},
}
],
"inboundNatPools": [],
"inboundNatRules": [
{
"name": "in-nat-rule",
"properties": {
"backendPort": 3389,
"enableFloatingIP": True,
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 3389,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp",
},
}
],
"loadBalancingRules": [
{
"name": "rulelb",
"properties": {
"backendAddressPool": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"
},
"backendPort": 80,
"disableOutboundSnat": True,
"enableFloatingIP": True,
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 80,
"idleTimeoutInMinutes": 15,
"loadDistribution": "Default",
"probe": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"
},
"protocol": "Tcp",
},
}
],
"outboundRules": [
{
"name": "rule1",
"properties": {
"backendAddressPool": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"
},
"frontendIPConfigurations": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
}
],
"protocol": "All",
},
}
],
"probes": [
{
"name": "probe-lb",
"properties": {
"intervalInSeconds": 15,
"numberOfProbes": 2,
"port": 80,
"probeThreshold": 1,
"protocol": "Http",
"requestPath": "healthcheck.aspx",
},
}
],
},
"sku": {"name": "Standard"},
},
).result()
print(response)
# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateWithOutboundRules.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armnetwork_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ab04533261eff228f28e08900445d0edef3eb70c/specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateWithOutboundRules.json
func ExampleLoadBalancersClient_BeginCreateOrUpdate_createLoadBalancerWithOutboundRules() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armnetwork.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewLoadBalancersClient().BeginCreateOrUpdate(ctx, "rg1", "lb", armnetwork.LoadBalancer{
Location: to.Ptr("eastus"),
Properties: &armnetwork.LoadBalancerPropertiesFormat{
BackendAddressPools: []*armnetwork.BackendAddressPool{
{
Name: to.Ptr("be-lb"),
Properties: &armnetwork.BackendAddressPoolPropertiesFormat{},
}},
FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{
{
Name: to.Ptr("fe-lb"),
Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{
PublicIPAddress: &armnetwork.PublicIPAddress{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pip"),
},
},
}},
InboundNatPools: []*armnetwork.InboundNatPool{},
InboundNatRules: []*armnetwork.InboundNatRule{
{
Name: to.Ptr("in-nat-rule"),
Properties: &armnetwork.InboundNatRulePropertiesFormat{
BackendPort: to.Ptr[int32](3389),
EnableFloatingIP: to.Ptr(true),
FrontendIPConfiguration: &armnetwork.SubResource{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
},
FrontendPort: to.Ptr[int32](3389),
IdleTimeoutInMinutes: to.Ptr[int32](15),
Protocol: to.Ptr(armnetwork.TransportProtocolTCP),
},
}},
LoadBalancingRules: []*armnetwork.LoadBalancingRule{
{
Name: to.Ptr("rulelb"),
Properties: &armnetwork.LoadBalancingRulePropertiesFormat{
BackendAddressPool: &armnetwork.SubResource{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"),
},
BackendPort: to.Ptr[int32](80),
DisableOutboundSnat: to.Ptr(true),
EnableFloatingIP: to.Ptr(true),
FrontendIPConfiguration: &armnetwork.SubResource{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
},
FrontendPort: to.Ptr[int32](80),
IdleTimeoutInMinutes: to.Ptr[int32](15),
LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault),
Probe: &armnetwork.SubResource{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"),
},
Protocol: to.Ptr(armnetwork.TransportProtocolTCP),
},
}},
OutboundRules: []*armnetwork.OutboundRule{
{
Name: to.Ptr("rule1"),
Properties: &armnetwork.OutboundRulePropertiesFormat{
BackendAddressPool: &armnetwork.SubResource{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"),
},
FrontendIPConfigurations: []*armnetwork.SubResource{
{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
}},
Protocol: to.Ptr(armnetwork.LoadBalancerOutboundRuleProtocolAll),
},
}},
Probes: []*armnetwork.Probe{
{
Name: to.Ptr("probe-lb"),
Properties: &armnetwork.ProbePropertiesFormat{
IntervalInSeconds: to.Ptr[int32](15),
NumberOfProbes: to.Ptr[int32](2),
Port: to.Ptr[int32](80),
ProbeThreshold: to.Ptr[int32](1),
RequestPath: to.Ptr("healthcheck.aspx"),
Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP),
},
}},
},
SKU: &armnetwork.LoadBalancerSKU{
Name: to.Ptr(armnetwork.LoadBalancerSKUNameStandard),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.LoadBalancer = armnetwork.LoadBalancer{
// Name: to.Ptr("lb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb"),
// Location: to.Ptr("eastus"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.LoadBalancerPropertiesFormat{
// BackendAddressPools: []*armnetwork.BackendAddressPool{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"),
// Name: to.Ptr("be-lb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/backendAddressPools"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.BackendAddressPoolPropertiesFormat{
// LoadBalancingRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"),
// }},
// OutboundRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/outboundRules/rule1"),
// }},
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// },
// }},
// FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
// Name: to.Ptr("fe-lb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/frontendIPConfigurations"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{
// InboundNatRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"),
// }},
// LoadBalancingRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"),
// }},
// OutboundRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/outboundRules/rule1"),
// }},
// PrivateIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4),
// PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic),
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// PublicIPAddress: &armnetwork.PublicIPAddress{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pip"),
// },
// },
// }},
// InboundNatPools: []*armnetwork.InboundNatPool{
// },
// InboundNatRules: []*armnetwork.InboundNatRule{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"),
// Name: to.Ptr("in-nat-rule"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/inboundNatRules"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.InboundNatRulePropertiesFormat{
// BackendPort: to.Ptr[int32](3389),
// EnableFloatingIP: to.Ptr(true),
// EnableTCPReset: to.Ptr(false),
// FrontendIPConfiguration: &armnetwork.SubResource{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
// },
// FrontendPort: to.Ptr[int32](3389),
// IdleTimeoutInMinutes: to.Ptr[int32](15),
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// Protocol: to.Ptr(armnetwork.TransportProtocolTCP),
// },
// }},
// LoadBalancingRules: []*armnetwork.LoadBalancingRule{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"),
// Name: to.Ptr("rulelb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/loadBalancingRules"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.LoadBalancingRulePropertiesFormat{
// BackendAddressPool: &armnetwork.SubResource{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"),
// },
// BackendPort: to.Ptr[int32](80),
// DisableOutboundSnat: to.Ptr(true),
// EnableFloatingIP: to.Ptr(true),
// EnableTCPReset: to.Ptr(false),
// FrontendIPConfiguration: &armnetwork.SubResource{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
// },
// FrontendPort: to.Ptr[int32](80),
// IdleTimeoutInMinutes: to.Ptr[int32](15),
// LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault),
// Probe: &armnetwork.SubResource{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"),
// },
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// Protocol: to.Ptr(armnetwork.TransportProtocolTCP),
// },
// }},
// OutboundRules: []*armnetwork.OutboundRule{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/outboundRules/rule1"),
// Name: to.Ptr("rule1"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/outboundRules"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.OutboundRulePropertiesFormat{
// AllocatedOutboundPorts: to.Ptr[int32](1024),
// BackendAddressPool: &armnetwork.SubResource{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"),
// },
// EnableTCPReset: to.Ptr(false),
// FrontendIPConfigurations: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
// }},
// IdleTimeoutInMinutes: to.Ptr[int32](4),
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// Protocol: to.Ptr(armnetwork.LoadBalancerOutboundRuleProtocolAll),
// },
// }},
// Probes: []*armnetwork.Probe{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"),
// Name: to.Ptr("probe-lb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/probes"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.ProbePropertiesFormat{
// IntervalInSeconds: to.Ptr[int32](15),
// LoadBalancingRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"),
// }},
// NumberOfProbes: to.Ptr[int32](2),
// Port: to.Ptr[int32](80),
// ProbeThreshold: to.Ptr[int32](1),
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// RequestPath: to.Ptr("healthcheck.aspx"),
// Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP),
// },
// }},
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"),
// },
// SKU: &armnetwork.LoadBalancerSKU{
// Name: to.Ptr(armnetwork.LoadBalancerSKUNameStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { NetworkManagementClient } = require("@azure/arm-network");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates a load balancer.
*
* @summary Creates or updates a load balancer.
* x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateWithOutboundRules.json
*/
async function createLoadBalancerWithOutboundRules() {
const subscriptionId = process.env["NETWORK_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["NETWORK_RESOURCE_GROUP"] || "rg1";
const loadBalancerName = "lb";
const parameters = {
backendAddressPools: [{ name: "be-lb" }],
frontendIPConfigurations: [
{
name: "fe-lb",
publicIPAddress: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pip",
},
},
],
inboundNatPools: [],
inboundNatRules: [
{
name: "in-nat-rule",
backendPort: 3389,
enableFloatingIP: true,
frontendIPConfiguration: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb",
},
frontendPort: 3389,
idleTimeoutInMinutes: 15,
protocol: "Tcp",
},
],
loadBalancingRules: [
{
name: "rulelb",
backendAddressPool: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb",
},
backendPort: 80,
disableOutboundSnat: true,
enableFloatingIP: true,
frontendIPConfiguration: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb",
},
frontendPort: 80,
idleTimeoutInMinutes: 15,
loadDistribution: "Default",
probe: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb",
},
protocol: "Tcp",
},
],
location: "eastus",
outboundRules: [
{
name: "rule1",
backendAddressPool: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb",
},
frontendIPConfigurations: [
{
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb",
},
],
protocol: "All",
},
],
probes: [
{
name: "probe-lb",
intervalInSeconds: 15,
numberOfProbes: 2,
port: 80,
probeThreshold: 1,
requestPath: "healthcheck.aspx",
protocol: "Http",
},
],
sku: { name: "Standard" },
};
const credential = new DefaultAzureCredential();
const client = new NetworkManagementClient(credential, subscriptionId);
const result = await client.loadBalancers.beginCreateOrUpdateAndWait(
resourceGroupName,
loadBalancerName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Network.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Resources.Models;
using Azure.ResourceManager.Network;
// Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateWithOutboundRules.json
// this example is just showing the usage of "LoadBalancers_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this LoadBalancerResource
LoadBalancerCollection collection = resourceGroupResource.GetLoadBalancers();
// invoke the operation
string loadBalancerName = "lb";
LoadBalancerData data = new LoadBalancerData
{
Sku = new LoadBalancerSku
{
Name = LoadBalancerSkuName.Standard,
},
FrontendIPConfigurations = {new FrontendIPConfigurationData
{
PublicIPAddress = new PublicIPAddressData
{
Id = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pip"),
},
Name = "fe-lb",
}},
BackendAddressPools = {new BackendAddressPoolData
{
Name = "be-lb",
}},
LoadBalancingRules = {new LoadBalancingRuleData
{
Properties = new LoadBalancingRuleProperties(LoadBalancingTransportProtocol.Tcp, 80)
{
FrontendIPConfigurationId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
BackendAddressPoolId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"),
ProbeId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"),
LoadDistribution = LoadDistribution.Default,
BackendPort = 80,
IdleTimeoutInMinutes = 15,
EnableFloatingIP = true,
DisableOutboundSnat = true,
},
Name = "rulelb",
}},
Probes = {new ProbeData
{
Protocol = ProbeProtocol.Http,
Port = 80,
IntervalInSeconds = 15,
NumberOfProbes = 2,
ProbeThreshold = 1,
RequestPath = "healthcheck.aspx",
Name = "probe-lb",
}},
InboundNatRules = {new InboundNatRuleData
{
FrontendIPConfigurationId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
Protocol = LoadBalancingTransportProtocol.Tcp,
FrontendPort = 3389,
BackendPort = 3389,
IdleTimeoutInMinutes = 15,
EnableFloatingIP = true,
Name = "in-nat-rule",
}},
InboundNatPools = { },
OutboundRules = {new OutboundRuleData
{
FrontendIPConfigurations = {new WritableSubResource
{
Id = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
}},
BackendAddressPoolId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"),
Protocol = LoadBalancerOutboundRuleProtocol.All,
Name = "rule1",
}},
Location = new AzureLocation("eastus"),
};
ArmOperation<LoadBalancerResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, loadBalancerName, data);
LoadBalancerResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
LoadBalancerData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"name": "lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb",
"type": "Microsoft.Network/loadBalancers",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"location": "eastus",
"sku": {
"name": "Standard"
},
"properties": {
"provisioningState": "Succeeded",
"resourceGuid": "00000000-0000-0000-0000-00000000",
"frontendIPConfigurations": [
{
"name": "fe-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb",
"type": "Microsoft.Network/loadBalancers/frontendIPConfigurations",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pip"
},
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
],
"inboundNatRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"
}
],
"outboundRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/outboundRules/rule1"
}
],
"privateIPAddressVersion": "IPv4"
}
}
],
"backendAddressPools": [
{
"name": "be-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb",
"type": "Microsoft.Network/loadBalancers/backendAddressPools",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"outboundRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/outboundRules/rule1"
}
],
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
}
],
"loadBalancingRules": [
{
"name": "rulelb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb",
"type": "Microsoft.Network/loadBalancers/loadBalancingRules",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 80,
"backendPort": 80,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp",
"enableTcpReset": false,
"loadDistribution": "Default",
"disableOutboundSnat": true,
"backendAddressPool": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"
},
"probe": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"
}
}
}
],
"probes": [
{
"name": "probe-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb",
"type": "Microsoft.Network/loadBalancers/probes",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"protocol": "Http",
"port": 80,
"requestPath": "healthcheck.aspx",
"intervalInSeconds": 15,
"numberOfProbes": 2,
"probeThreshold": 1,
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
}
],
"inboundNatRules": [
{
"name": "in-nat-rule",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule",
"type": "Microsoft.Network/loadBalancers/inboundNatRules",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 3389,
"backendPort": 3389,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp",
"enableTcpReset": false
}
}
],
"outboundRules": [
{
"name": "rule1",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/outboundRules/rule1",
"type": "Microsoft.Network/loadBalancers/outboundRules",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"allocatedOutboundPorts": 1024,
"protocol": "All",
"enableTcpReset": false,
"idleTimeoutInMinutes": 4,
"backendAddressPool": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"
},
"frontendIPConfigurations": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
}
]
}
}
],
"inboundNatPools": []
}
}
{
"name": "lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb",
"type": "Microsoft.Network/loadBalancers",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"location": "eastus",
"sku": {
"name": "Standard"
},
"properties": {
"provisioningState": "Succeeded",
"resourceGuid": "00000000-0000-0000-0000-00000000",
"frontendIPConfigurations": [
{
"name": "fe-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb",
"type": "Microsoft.Network/loadBalancers/frontendIPConfigurations",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pip"
},
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
],
"inboundNatRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"
}
],
"outboundRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/outboundRules/rule1"
}
],
"privateIPAddressVersion": "IPv4"
}
}
],
"backendAddressPools": [
{
"name": "be-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb",
"type": "Microsoft.Network/loadBalancers/backendAddressPools",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"outboundRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/outboundRules/rule1"
}
],
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
}
],
"loadBalancingRules": [
{
"name": "rulelb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb",
"type": "Microsoft.Network/loadBalancers/loadBalancingRules",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 80,
"backendPort": 80,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp",
"enableTcpReset": false,
"loadDistribution": "Default",
"disableOutboundSnat": true,
"backendAddressPool": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"
},
"probe": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"
}
}
}
],
"probes": [
{
"name": "probe-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb",
"type": "Microsoft.Network/loadBalancers/probes",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"protocol": "Http",
"port": 80,
"requestPath": "healthcheck.aspx",
"intervalInSeconds": 15,
"numberOfProbes": 2,
"probeThreshold": 1,
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
}
],
"inboundNatRules": [
{
"name": "in-nat-rule",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule",
"type": "Microsoft.Network/loadBalancers/inboundNatRules",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 3389,
"backendPort": 3389,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp",
"enableTcpReset": false
}
}
],
"outboundRules": [
{
"name": "rule1",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/outboundRules/rule1",
"type": "Microsoft.Network/loadBalancers/outboundRules",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"allocatedOutboundPorts": 1024,
"protocol": "All",
"enableTcpReset": false,
"idleTimeoutInMinutes": 4,
"backendAddressPool": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"
},
"frontendIPConfigurations": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
}
]
}
}
],
"inboundNatPools": []
}
}
Create load balancer with Standard SKU
要求のサンプル
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb?api-version=2024-05-01
{
"location": "eastus",
"sku": {
"name": "Standard"
},
"properties": {
"frontendIPConfigurations": [
{
"name": "fe-lb",
"properties": {
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"
}
}
}
],
"backendAddressPools": [
{
"name": "be-lb",
"properties": {}
}
],
"loadBalancingRules": [
{
"name": "rulelb",
"properties": {
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 80,
"backendPort": 80,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp",
"loadDistribution": "Default",
"backendAddressPool": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"
},
"probe": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"
}
}
}
],
"probes": [
{
"name": "probe-lb",
"properties": {
"protocol": "Http",
"port": 80,
"requestPath": "healthcheck.aspx",
"intervalInSeconds": 15,
"numberOfProbes": 2,
"probeThreshold": 1
}
}
],
"inboundNatRules": [
{
"name": "in-nat-rule",
"properties": {
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 3389,
"backendPort": 3389,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp"
}
}
],
"inboundNatPools": [],
"outboundRules": []
}
}
import com.azure.core.management.SubResource;
import com.azure.resourcemanager.network.fluent.models.BackendAddressPoolInner;
import com.azure.resourcemanager.network.fluent.models.FrontendIpConfigurationInner;
import com.azure.resourcemanager.network.fluent.models.InboundNatRuleInner;
import com.azure.resourcemanager.network.fluent.models.LoadBalancerInner;
import com.azure.resourcemanager.network.fluent.models.LoadBalancingRuleInner;
import com.azure.resourcemanager.network.fluent.models.ProbeInner;
import com.azure.resourcemanager.network.fluent.models.SubnetInner;
import com.azure.resourcemanager.network.models.LoadBalancerSku;
import com.azure.resourcemanager.network.models.LoadBalancerSkuName;
import com.azure.resourcemanager.network.models.LoadDistribution;
import com.azure.resourcemanager.network.models.ProbeProtocol;
import com.azure.resourcemanager.network.models.TransportProtocol;
import java.util.Arrays;
/**
* Samples for LoadBalancers CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateStandardSku
* .json
*/
/**
* Sample code: Create load balancer with Standard SKU.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createLoadBalancerWithStandardSKU(com.azure.resourcemanager.AzureResourceManager azure) {
azure.networks().manager().serviceClient().getLoadBalancers().createOrUpdate("rg1", "lb",
new LoadBalancerInner().withLocation("eastus")
.withSku(new LoadBalancerSku().withName(LoadBalancerSkuName.STANDARD))
.withFrontendIpConfigurations(Arrays.asList(new FrontendIpConfigurationInner().withName("fe-lb")
.withSubnet(new SubnetInner().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"))))
.withBackendAddressPools(Arrays.asList(new BackendAddressPoolInner().withName("be-lb")))
.withLoadBalancingRules(Arrays.asList(new LoadBalancingRuleInner().withName("rulelb")
.withFrontendIpConfiguration(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"))
.withBackendAddressPool(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"))
.withProbe(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"))
.withProtocol(TransportProtocol.TCP).withLoadDistribution(LoadDistribution.DEFAULT)
.withFrontendPort(80).withBackendPort(80).withIdleTimeoutInMinutes(15).withEnableFloatingIp(true)))
.withProbes(Arrays.asList(new ProbeInner().withName("probe-lb").withProtocol(ProbeProtocol.HTTP)
.withPort(80).withIntervalInSeconds(15).withNumberOfProbes(2).withProbeThreshold(1)
.withRequestPath("healthcheck.aspx")))
.withInboundNatRules(Arrays.asList(new InboundNatRuleInner().withName("in-nat-rule")
.withFrontendIpConfiguration(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"))
.withProtocol(TransportProtocol.TCP).withFrontendPort(3389).withBackendPort(3389)
.withIdleTimeoutInMinutes(15).withEnableFloatingIp(true)))
.withInboundNatPools(Arrays.asList()).withOutboundRules(Arrays.asList()),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.network import NetworkManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-network
# USAGE
python load_balancer_create_standard_sku.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = NetworkManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.load_balancers.begin_create_or_update(
resource_group_name="rg1",
load_balancer_name="lb",
parameters={
"location": "eastus",
"properties": {
"backendAddressPools": [{"name": "be-lb", "properties": {}}],
"frontendIPConfigurations": [
{
"name": "fe-lb",
"properties": {
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"
}
},
}
],
"inboundNatPools": [],
"inboundNatRules": [
{
"name": "in-nat-rule",
"properties": {
"backendPort": 3389,
"enableFloatingIP": True,
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 3389,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp",
},
}
],
"loadBalancingRules": [
{
"name": "rulelb",
"properties": {
"backendAddressPool": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"
},
"backendPort": 80,
"enableFloatingIP": True,
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 80,
"idleTimeoutInMinutes": 15,
"loadDistribution": "Default",
"probe": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"
},
"protocol": "Tcp",
},
}
],
"outboundRules": [],
"probes": [
{
"name": "probe-lb",
"properties": {
"intervalInSeconds": 15,
"numberOfProbes": 2,
"port": 80,
"probeThreshold": 1,
"protocol": "Http",
"requestPath": "healthcheck.aspx",
},
}
],
},
"sku": {"name": "Standard"},
},
).result()
print(response)
# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateStandardSku.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armnetwork_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ab04533261eff228f28e08900445d0edef3eb70c/specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateStandardSku.json
func ExampleLoadBalancersClient_BeginCreateOrUpdate_createLoadBalancerWithStandardSku() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armnetwork.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewLoadBalancersClient().BeginCreateOrUpdate(ctx, "rg1", "lb", armnetwork.LoadBalancer{
Location: to.Ptr("eastus"),
Properties: &armnetwork.LoadBalancerPropertiesFormat{
BackendAddressPools: []*armnetwork.BackendAddressPool{
{
Name: to.Ptr("be-lb"),
Properties: &armnetwork.BackendAddressPoolPropertiesFormat{},
}},
FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{
{
Name: to.Ptr("fe-lb"),
Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{
Subnet: &armnetwork.Subnet{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"),
},
},
}},
InboundNatPools: []*armnetwork.InboundNatPool{},
InboundNatRules: []*armnetwork.InboundNatRule{
{
Name: to.Ptr("in-nat-rule"),
Properties: &armnetwork.InboundNatRulePropertiesFormat{
BackendPort: to.Ptr[int32](3389),
EnableFloatingIP: to.Ptr(true),
FrontendIPConfiguration: &armnetwork.SubResource{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
},
FrontendPort: to.Ptr[int32](3389),
IdleTimeoutInMinutes: to.Ptr[int32](15),
Protocol: to.Ptr(armnetwork.TransportProtocolTCP),
},
}},
LoadBalancingRules: []*armnetwork.LoadBalancingRule{
{
Name: to.Ptr("rulelb"),
Properties: &armnetwork.LoadBalancingRulePropertiesFormat{
BackendAddressPool: &armnetwork.SubResource{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"),
},
BackendPort: to.Ptr[int32](80),
EnableFloatingIP: to.Ptr(true),
FrontendIPConfiguration: &armnetwork.SubResource{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
},
FrontendPort: to.Ptr[int32](80),
IdleTimeoutInMinutes: to.Ptr[int32](15),
LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault),
Probe: &armnetwork.SubResource{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"),
},
Protocol: to.Ptr(armnetwork.TransportProtocolTCP),
},
}},
OutboundRules: []*armnetwork.OutboundRule{},
Probes: []*armnetwork.Probe{
{
Name: to.Ptr("probe-lb"),
Properties: &armnetwork.ProbePropertiesFormat{
IntervalInSeconds: to.Ptr[int32](15),
NumberOfProbes: to.Ptr[int32](2),
Port: to.Ptr[int32](80),
ProbeThreshold: to.Ptr[int32](1),
RequestPath: to.Ptr("healthcheck.aspx"),
Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP),
},
}},
},
SKU: &armnetwork.LoadBalancerSKU{
Name: to.Ptr(armnetwork.LoadBalancerSKUNameStandard),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.LoadBalancer = armnetwork.LoadBalancer{
// Name: to.Ptr("lb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb"),
// Location: to.Ptr("eastus"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.LoadBalancerPropertiesFormat{
// BackendAddressPools: []*armnetwork.BackendAddressPool{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"),
// Name: to.Ptr("be-lb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/backendAddressPools"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.BackendAddressPoolPropertiesFormat{
// LoadBalancingRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"),
// }},
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// },
// }},
// FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
// Name: to.Ptr("fe-lb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/frontendIPConfigurations"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{
// InboundNatRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"),
// }},
// LoadBalancingRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"),
// }},
// PrivateIPAddress: to.Ptr("10.0.1.4"),
// PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic),
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// Subnet: &armnetwork.Subnet{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"),
// },
// },
// }},
// InboundNatPools: []*armnetwork.InboundNatPool{
// },
// InboundNatRules: []*armnetwork.InboundNatRule{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"),
// Name: to.Ptr("in-nat-rule"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/inboundNatRules"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.InboundNatRulePropertiesFormat{
// BackendPort: to.Ptr[int32](3389),
// EnableFloatingIP: to.Ptr(true),
// FrontendIPConfiguration: &armnetwork.SubResource{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
// },
// FrontendPort: to.Ptr[int32](3389),
// IdleTimeoutInMinutes: to.Ptr[int32](15),
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// Protocol: to.Ptr(armnetwork.TransportProtocolTCP),
// },
// }},
// LoadBalancingRules: []*armnetwork.LoadBalancingRule{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"),
// Name: to.Ptr("rulelb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/loadBalancingRules"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.LoadBalancingRulePropertiesFormat{
// BackendAddressPool: &armnetwork.SubResource{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"),
// },
// BackendPort: to.Ptr[int32](80),
// DisableOutboundSnat: to.Ptr(false),
// EnableFloatingIP: to.Ptr(true),
// FrontendIPConfiguration: &armnetwork.SubResource{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
// },
// FrontendPort: to.Ptr[int32](80),
// IdleTimeoutInMinutes: to.Ptr[int32](15),
// LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault),
// Probe: &armnetwork.SubResource{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"),
// },
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// Protocol: to.Ptr(armnetwork.TransportProtocolTCP),
// },
// }},
// OutboundRules: []*armnetwork.OutboundRule{
// },
// Probes: []*armnetwork.Probe{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"),
// Name: to.Ptr("probe-lb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/probes"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.ProbePropertiesFormat{
// IntervalInSeconds: to.Ptr[int32](15),
// LoadBalancingRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"),
// }},
// NumberOfProbes: to.Ptr[int32](2),
// Port: to.Ptr[int32](80),
// ProbeThreshold: to.Ptr[int32](1),
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// RequestPath: to.Ptr("healthcheck.aspx"),
// Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP),
// },
// }},
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"),
// },
// SKU: &armnetwork.LoadBalancerSKU{
// Name: to.Ptr(armnetwork.LoadBalancerSKUNameStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { NetworkManagementClient } = require("@azure/arm-network");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates a load balancer.
*
* @summary Creates or updates a load balancer.
* x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateStandardSku.json
*/
async function createLoadBalancerWithStandardSku() {
const subscriptionId = process.env["NETWORK_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["NETWORK_RESOURCE_GROUP"] || "rg1";
const loadBalancerName = "lb";
const parameters = {
backendAddressPools: [{ name: "be-lb" }],
frontendIPConfigurations: [
{
name: "fe-lb",
subnet: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb",
},
},
],
inboundNatPools: [],
inboundNatRules: [
{
name: "in-nat-rule",
backendPort: 3389,
enableFloatingIP: true,
frontendIPConfiguration: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb",
},
frontendPort: 3389,
idleTimeoutInMinutes: 15,
protocol: "Tcp",
},
],
loadBalancingRules: [
{
name: "rulelb",
backendAddressPool: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb",
},
backendPort: 80,
enableFloatingIP: true,
frontendIPConfiguration: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb",
},
frontendPort: 80,
idleTimeoutInMinutes: 15,
loadDistribution: "Default",
probe: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb",
},
protocol: "Tcp",
},
],
location: "eastus",
outboundRules: [],
probes: [
{
name: "probe-lb",
intervalInSeconds: 15,
numberOfProbes: 2,
port: 80,
probeThreshold: 1,
requestPath: "healthcheck.aspx",
protocol: "Http",
},
],
sku: { name: "Standard" },
};
const credential = new DefaultAzureCredential();
const client = new NetworkManagementClient(credential, subscriptionId);
const result = await client.loadBalancers.beginCreateOrUpdateAndWait(
resourceGroupName,
loadBalancerName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Network.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Resources.Models;
using Azure.ResourceManager.Network;
// Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateStandardSku.json
// this example is just showing the usage of "LoadBalancers_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this LoadBalancerResource
LoadBalancerCollection collection = resourceGroupResource.GetLoadBalancers();
// invoke the operation
string loadBalancerName = "lb";
LoadBalancerData data = new LoadBalancerData
{
Sku = new LoadBalancerSku
{
Name = LoadBalancerSkuName.Standard,
},
FrontendIPConfigurations = {new FrontendIPConfigurationData
{
Subnet = new SubnetData
{
Id = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"),
},
Name = "fe-lb",
}},
BackendAddressPools = {new BackendAddressPoolData
{
Name = "be-lb",
}},
LoadBalancingRules = {new LoadBalancingRuleData
{
Properties = new LoadBalancingRuleProperties(LoadBalancingTransportProtocol.Tcp, 80)
{
FrontendIPConfigurationId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
BackendAddressPoolId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"),
ProbeId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"),
LoadDistribution = LoadDistribution.Default,
BackendPort = 80,
IdleTimeoutInMinutes = 15,
EnableFloatingIP = true,
},
Name = "rulelb",
}},
Probes = {new ProbeData
{
Protocol = ProbeProtocol.Http,
Port = 80,
IntervalInSeconds = 15,
NumberOfProbes = 2,
ProbeThreshold = 1,
RequestPath = "healthcheck.aspx",
Name = "probe-lb",
}},
InboundNatRules = {new InboundNatRuleData
{
FrontendIPConfigurationId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
Protocol = LoadBalancingTransportProtocol.Tcp,
FrontendPort = 3389,
BackendPort = 3389,
IdleTimeoutInMinutes = 15,
EnableFloatingIP = true,
Name = "in-nat-rule",
}},
InboundNatPools = { },
OutboundRules = { },
Location = new AzureLocation("eastus"),
};
ArmOperation<LoadBalancerResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, loadBalancerName, data);
LoadBalancerResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
LoadBalancerData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"name": "lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb",
"type": "Microsoft.Network/loadBalancers",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"location": "eastus",
"sku": {
"name": "Standard"
},
"properties": {
"provisioningState": "Succeeded",
"resourceGuid": "00000000-0000-0000-0000-00000000",
"frontendIPConfigurations": [
{
"name": "fe-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb",
"type": "Microsoft.Network/loadBalancers/frontendIPConfigurations",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"privateIPAddress": "10.0.1.4",
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"
},
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
],
"inboundNatRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"
}
]
}
}
],
"backendAddressPools": [
{
"name": "be-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb",
"type": "Microsoft.Network/loadBalancers/backendAddressPools",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
}
],
"loadBalancingRules": [
{
"name": "rulelb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb",
"type": "Microsoft.Network/loadBalancers/loadBalancingRules",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 80,
"backendPort": 80,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp",
"loadDistribution": "Default",
"backendAddressPool": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"
},
"probe": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"
},
"disableOutboundSnat": false
}
}
],
"probes": [
{
"name": "probe-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb",
"type": "Microsoft.Network/loadBalancers/probes",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"protocol": "Http",
"port": 80,
"requestPath": "healthcheck.aspx",
"intervalInSeconds": 15,
"numberOfProbes": 2,
"probeThreshold": 1,
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
}
],
"inboundNatRules": [
{
"name": "in-nat-rule",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule",
"type": "Microsoft.Network/loadBalancers/inboundNatRules",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 3389,
"backendPort": 3389,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp"
}
}
],
"outboundRules": [],
"inboundNatPools": []
}
}
{
"name": "lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb",
"type": "Microsoft.Network/loadBalancers",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"location": "eastus",
"sku": {
"name": "Standard"
},
"properties": {
"provisioningState": "Succeeded",
"resourceGuid": "00000000-0000-0000-0000-00000000",
"frontendIPConfigurations": [
{
"name": "fe-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb",
"type": "Microsoft.Network/loadBalancers/frontendIPConfigurations",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"privateIPAddress": "10.0.1.4",
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"
},
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
],
"inboundNatRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"
}
]
}
}
],
"backendAddressPools": [
{
"name": "be-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb",
"type": "Microsoft.Network/loadBalancers/backendAddressPools",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
}
],
"loadBalancingRules": [
{
"name": "rulelb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb",
"type": "Microsoft.Network/loadBalancers/loadBalancingRules",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 80,
"backendPort": 80,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp",
"loadDistribution": "Default",
"backendAddressPool": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"
},
"probe": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"
},
"disableOutboundSnat": false
}
}
],
"probes": [
{
"name": "probe-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb",
"type": "Microsoft.Network/loadBalancers/probes",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"protocol": "Http",
"port": 80,
"requestPath": "healthcheck.aspx",
"intervalInSeconds": 15,
"numberOfProbes": 2,
"probeThreshold": 1,
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
}
],
"inboundNatRules": [
{
"name": "in-nat-rule",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule",
"type": "Microsoft.Network/loadBalancers/inboundNatRules",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 3389,
"backendPort": 3389,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp"
}
}
],
"outboundRules": [],
"inboundNatPools": []
}
}
Create load balancer with Sync Mode Property on Pool
要求のサンプル
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb?api-version=2024-05-01
{
"location": "eastus",
"sku": {
"name": "Standard"
},
"properties": {
"frontendIPConfigurations": [
{
"name": "fe-lb",
"properties": {
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"
}
}
}
],
"backendAddressPools": [
{
"name": "be-lb",
"properties": {
"syncMode": "Automatic",
"virtualNetwork": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb"
}
}
}
],
"loadBalancingRules": [
{
"name": "rulelb",
"properties": {
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 80,
"backendPort": 80,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp",
"loadDistribution": "Default",
"backendAddressPool": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"
},
"probe": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"
}
}
}
],
"probes": [
{
"name": "probe-lb",
"properties": {
"protocol": "Http",
"port": 80,
"requestPath": "healthcheck.aspx",
"intervalInSeconds": 15,
"numberOfProbes": 2,
"probeThreshold": 1
}
}
],
"inboundNatRules": [
{
"name": "in-nat-rule",
"properties": {
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 3389,
"backendPort": 3389,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp"
}
}
],
"inboundNatPools": [],
"outboundRules": []
}
}
import com.azure.core.management.SubResource;
import com.azure.resourcemanager.network.fluent.models.BackendAddressPoolInner;
import com.azure.resourcemanager.network.fluent.models.FrontendIpConfigurationInner;
import com.azure.resourcemanager.network.fluent.models.InboundNatRuleInner;
import com.azure.resourcemanager.network.fluent.models.LoadBalancerInner;
import com.azure.resourcemanager.network.fluent.models.LoadBalancingRuleInner;
import com.azure.resourcemanager.network.fluent.models.ProbeInner;
import com.azure.resourcemanager.network.fluent.models.SubnetInner;
import com.azure.resourcemanager.network.models.LoadBalancerSku;
import com.azure.resourcemanager.network.models.LoadBalancerSkuName;
import com.azure.resourcemanager.network.models.LoadDistribution;
import com.azure.resourcemanager.network.models.ProbeProtocol;
import com.azure.resourcemanager.network.models.SyncMode;
import com.azure.resourcemanager.network.models.TransportProtocol;
import java.util.Arrays;
/**
* Samples for LoadBalancers CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/
* LoadBalancerCreateWithSyncModePropertyOnPool.json
*/
/**
* Sample code: Create load balancer with Sync Mode Property on Pool.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void
createLoadBalancerWithSyncModePropertyOnPool(com.azure.resourcemanager.AzureResourceManager azure) {
azure.networks().manager().serviceClient().getLoadBalancers().createOrUpdate("rg1", "lb",
new LoadBalancerInner().withLocation("eastus")
.withSku(new LoadBalancerSku().withName(LoadBalancerSkuName.STANDARD))
.withFrontendIpConfigurations(Arrays.asList(new FrontendIpConfigurationInner().withName("fe-lb")
.withSubnet(new SubnetInner().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"))))
.withBackendAddressPools(Arrays.asList(new BackendAddressPoolInner().withName("be-lb")
.withVirtualNetwork(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb"))
.withSyncMode(SyncMode.AUTOMATIC)))
.withLoadBalancingRules(Arrays.asList(new LoadBalancingRuleInner().withName("rulelb")
.withFrontendIpConfiguration(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"))
.withBackendAddressPool(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"))
.withProbe(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"))
.withProtocol(TransportProtocol.TCP).withLoadDistribution(LoadDistribution.DEFAULT)
.withFrontendPort(80).withBackendPort(80).withIdleTimeoutInMinutes(15).withEnableFloatingIp(true)))
.withProbes(Arrays.asList(new ProbeInner().withName("probe-lb").withProtocol(ProbeProtocol.HTTP)
.withPort(80).withIntervalInSeconds(15).withNumberOfProbes(2).withProbeThreshold(1)
.withRequestPath("healthcheck.aspx")))
.withInboundNatRules(Arrays.asList(new InboundNatRuleInner().withName("in-nat-rule")
.withFrontendIpConfiguration(new SubResource().withId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"))
.withProtocol(TransportProtocol.TCP).withFrontendPort(3389).withBackendPort(3389)
.withIdleTimeoutInMinutes(15).withEnableFloatingIp(true)))
.withInboundNatPools(Arrays.asList()).withOutboundRules(Arrays.asList()),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.network import NetworkManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-network
# USAGE
python load_balancer_create_with_sync_mode_property_on_pool.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = NetworkManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.load_balancers.begin_create_or_update(
resource_group_name="rg1",
load_balancer_name="lb",
parameters={
"location": "eastus",
"properties": {
"backendAddressPools": [
{
"name": "be-lb",
"properties": {
"syncMode": "Automatic",
"virtualNetwork": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb"
},
},
}
],
"frontendIPConfigurations": [
{
"name": "fe-lb",
"properties": {
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"
}
},
}
],
"inboundNatPools": [],
"inboundNatRules": [
{
"name": "in-nat-rule",
"properties": {
"backendPort": 3389,
"enableFloatingIP": True,
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 3389,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp",
},
}
],
"loadBalancingRules": [
{
"name": "rulelb",
"properties": {
"backendAddressPool": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"
},
"backendPort": 80,
"enableFloatingIP": True,
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 80,
"idleTimeoutInMinutes": 15,
"loadDistribution": "Default",
"probe": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"
},
"protocol": "Tcp",
},
}
],
"outboundRules": [],
"probes": [
{
"name": "probe-lb",
"properties": {
"intervalInSeconds": 15,
"numberOfProbes": 2,
"port": 80,
"probeThreshold": 1,
"protocol": "Http",
"requestPath": "healthcheck.aspx",
},
}
],
},
"sku": {"name": "Standard"},
},
).result()
print(response)
# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateWithSyncModePropertyOnPool.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armnetwork_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ab04533261eff228f28e08900445d0edef3eb70c/specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateWithSyncModePropertyOnPool.json
func ExampleLoadBalancersClient_BeginCreateOrUpdate_createLoadBalancerWithSyncModePropertyOnPool() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armnetwork.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewLoadBalancersClient().BeginCreateOrUpdate(ctx, "rg1", "lb", armnetwork.LoadBalancer{
Location: to.Ptr("eastus"),
Properties: &armnetwork.LoadBalancerPropertiesFormat{
BackendAddressPools: []*armnetwork.BackendAddressPool{
{
Name: to.Ptr("be-lb"),
Properties: &armnetwork.BackendAddressPoolPropertiesFormat{
SyncMode: to.Ptr(armnetwork.SyncModeAutomatic),
VirtualNetwork: &armnetwork.SubResource{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb"),
},
},
}},
FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{
{
Name: to.Ptr("fe-lb"),
Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{
Subnet: &armnetwork.Subnet{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"),
},
},
}},
InboundNatPools: []*armnetwork.InboundNatPool{},
InboundNatRules: []*armnetwork.InboundNatRule{
{
Name: to.Ptr("in-nat-rule"),
Properties: &armnetwork.InboundNatRulePropertiesFormat{
BackendPort: to.Ptr[int32](3389),
EnableFloatingIP: to.Ptr(true),
FrontendIPConfiguration: &armnetwork.SubResource{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
},
FrontendPort: to.Ptr[int32](3389),
IdleTimeoutInMinutes: to.Ptr[int32](15),
Protocol: to.Ptr(armnetwork.TransportProtocolTCP),
},
}},
LoadBalancingRules: []*armnetwork.LoadBalancingRule{
{
Name: to.Ptr("rulelb"),
Properties: &armnetwork.LoadBalancingRulePropertiesFormat{
BackendAddressPool: &armnetwork.SubResource{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"),
},
BackendPort: to.Ptr[int32](80),
EnableFloatingIP: to.Ptr(true),
FrontendIPConfiguration: &armnetwork.SubResource{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
},
FrontendPort: to.Ptr[int32](80),
IdleTimeoutInMinutes: to.Ptr[int32](15),
LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault),
Probe: &armnetwork.SubResource{
ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"),
},
Protocol: to.Ptr(armnetwork.TransportProtocolTCP),
},
}},
OutboundRules: []*armnetwork.OutboundRule{},
Probes: []*armnetwork.Probe{
{
Name: to.Ptr("probe-lb"),
Properties: &armnetwork.ProbePropertiesFormat{
IntervalInSeconds: to.Ptr[int32](15),
NumberOfProbes: to.Ptr[int32](2),
Port: to.Ptr[int32](80),
ProbeThreshold: to.Ptr[int32](1),
RequestPath: to.Ptr("healthcheck.aspx"),
Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP),
},
}},
},
SKU: &armnetwork.LoadBalancerSKU{
Name: to.Ptr(armnetwork.LoadBalancerSKUNameStandard),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.LoadBalancer = armnetwork.LoadBalancer{
// Name: to.Ptr("lb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb"),
// Location: to.Ptr("eastus"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.LoadBalancerPropertiesFormat{
// BackendAddressPools: []*armnetwork.BackendAddressPool{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"),
// Name: to.Ptr("be-lb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/backendAddressPools"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.BackendAddressPoolPropertiesFormat{
// LoadBalancingRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"),
// }},
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// SyncMode: to.Ptr(armnetwork.SyncModeAutomatic),
// VirtualNetwork: &armnetwork.SubResource{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb"),
// },
// },
// }},
// FrontendIPConfigurations: []*armnetwork.FrontendIPConfiguration{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
// Name: to.Ptr("fe-lb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/frontendIPConfigurations"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.FrontendIPConfigurationPropertiesFormat{
// InboundNatRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"),
// }},
// LoadBalancingRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"),
// }},
// PrivateIPAddress: to.Ptr("10.0.1.4"),
// PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic),
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// Subnet: &armnetwork.Subnet{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"),
// },
// },
// }},
// InboundNatPools: []*armnetwork.InboundNatPool{
// },
// InboundNatRules: []*armnetwork.InboundNatRule{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"),
// Name: to.Ptr("in-nat-rule"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/inboundNatRules"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.InboundNatRulePropertiesFormat{
// BackendPort: to.Ptr[int32](3389),
// EnableFloatingIP: to.Ptr(true),
// FrontendIPConfiguration: &armnetwork.SubResource{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
// },
// FrontendPort: to.Ptr[int32](3389),
// IdleTimeoutInMinutes: to.Ptr[int32](15),
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// Protocol: to.Ptr(armnetwork.TransportProtocolTCP),
// },
// }},
// LoadBalancingRules: []*armnetwork.LoadBalancingRule{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"),
// Name: to.Ptr("rulelb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/loadBalancingRules"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.LoadBalancingRulePropertiesFormat{
// BackendAddressPool: &armnetwork.SubResource{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"),
// },
// BackendPort: to.Ptr[int32](80),
// DisableOutboundSnat: to.Ptr(false),
// EnableFloatingIP: to.Ptr(true),
// FrontendIPConfiguration: &armnetwork.SubResource{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
// },
// FrontendPort: to.Ptr[int32](80),
// IdleTimeoutInMinutes: to.Ptr[int32](15),
// LoadDistribution: to.Ptr(armnetwork.LoadDistributionDefault),
// Probe: &armnetwork.SubResource{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"),
// },
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// Protocol: to.Ptr(armnetwork.TransportProtocolTCP),
// },
// }},
// OutboundRules: []*armnetwork.OutboundRule{
// },
// Probes: []*armnetwork.Probe{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"),
// Name: to.Ptr("probe-lb"),
// Type: to.Ptr("Microsoft.Network/loadBalancers/probes"),
// Etag: to.Ptr("W/\"00000000-0000-0000-0000-00000000\""),
// Properties: &armnetwork.ProbePropertiesFormat{
// IntervalInSeconds: to.Ptr[int32](15),
// LoadBalancingRules: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"),
// }},
// NumberOfProbes: to.Ptr[int32](2),
// Port: to.Ptr[int32](80),
// ProbeThreshold: to.Ptr[int32](1),
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// RequestPath: to.Ptr("healthcheck.aspx"),
// Protocol: to.Ptr(armnetwork.ProbeProtocolHTTP),
// },
// }},
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// ResourceGUID: to.Ptr("00000000-0000-0000-0000-00000000"),
// },
// SKU: &armnetwork.LoadBalancerSKU{
// Name: to.Ptr(armnetwork.LoadBalancerSKUNameStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { NetworkManagementClient } = require("@azure/arm-network");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates a load balancer.
*
* @summary Creates or updates a load balancer.
* x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateWithSyncModePropertyOnPool.json
*/
async function createLoadBalancerWithSyncModePropertyOnPool() {
const subscriptionId = process.env["NETWORK_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["NETWORK_RESOURCE_GROUP"] || "rg1";
const loadBalancerName = "lb";
const parameters = {
backendAddressPools: [
{
name: "be-lb",
syncMode: "Automatic",
virtualNetwork: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb",
},
},
],
frontendIPConfigurations: [
{
name: "fe-lb",
subnet: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb",
},
},
],
inboundNatPools: [],
inboundNatRules: [
{
name: "in-nat-rule",
backendPort: 3389,
enableFloatingIP: true,
frontendIPConfiguration: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb",
},
frontendPort: 3389,
idleTimeoutInMinutes: 15,
protocol: "Tcp",
},
],
loadBalancingRules: [
{
name: "rulelb",
backendAddressPool: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb",
},
backendPort: 80,
enableFloatingIP: true,
frontendIPConfiguration: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb",
},
frontendPort: 80,
idleTimeoutInMinutes: 15,
loadDistribution: "Default",
probe: {
id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb",
},
protocol: "Tcp",
},
],
location: "eastus",
outboundRules: [],
probes: [
{
name: "probe-lb",
intervalInSeconds: 15,
numberOfProbes: 2,
port: 80,
probeThreshold: 1,
requestPath: "healthcheck.aspx",
protocol: "Http",
},
],
sku: { name: "Standard" },
};
const credential = new DefaultAzureCredential();
const client = new NetworkManagementClient(credential, subscriptionId);
const result = await client.loadBalancers.beginCreateOrUpdateAndWait(
resourceGroupName,
loadBalancerName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Network.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Resources.Models;
using Azure.ResourceManager.Network;
// Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2024-05-01/examples/LoadBalancerCreateWithSyncModePropertyOnPool.json
// this example is just showing the usage of "LoadBalancers_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this LoadBalancerResource
LoadBalancerCollection collection = resourceGroupResource.GetLoadBalancers();
// invoke the operation
string loadBalancerName = "lb";
LoadBalancerData data = new LoadBalancerData
{
Sku = new LoadBalancerSku
{
Name = LoadBalancerSkuName.Standard,
},
FrontendIPConfigurations = {new FrontendIPConfigurationData
{
Subnet = new SubnetData
{
Id = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"),
},
Name = "fe-lb",
}},
BackendAddressPools = {new BackendAddressPoolData
{
VirtualNetworkId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb"),
SyncMode = BackendAddressSyncMode.Automatic,
Name = "be-lb",
}},
LoadBalancingRules = {new LoadBalancingRuleData
{
Properties = new LoadBalancingRuleProperties(LoadBalancingTransportProtocol.Tcp, 80)
{
FrontendIPConfigurationId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
BackendAddressPoolId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"),
ProbeId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"),
LoadDistribution = LoadDistribution.Default,
BackendPort = 80,
IdleTimeoutInMinutes = 15,
EnableFloatingIP = true,
},
Name = "rulelb",
}},
Probes = {new ProbeData
{
Protocol = ProbeProtocol.Http,
Port = 80,
IntervalInSeconds = 15,
NumberOfProbes = 2,
ProbeThreshold = 1,
RequestPath = "healthcheck.aspx",
Name = "probe-lb",
}},
InboundNatRules = {new InboundNatRuleData
{
FrontendIPConfigurationId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"),
Protocol = LoadBalancingTransportProtocol.Tcp,
FrontendPort = 3389,
BackendPort = 3389,
IdleTimeoutInMinutes = 15,
EnableFloatingIP = true,
Name = "in-nat-rule",
}},
InboundNatPools = { },
OutboundRules = { },
Location = new AzureLocation("eastus"),
};
ArmOperation<LoadBalancerResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, loadBalancerName, data);
LoadBalancerResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
LoadBalancerData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"name": "lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb",
"type": "Microsoft.Network/loadBalancers",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"location": "eastus",
"sku": {
"name": "Standard"
},
"properties": {
"provisioningState": "Succeeded",
"resourceGuid": "00000000-0000-0000-0000-00000000",
"frontendIPConfigurations": [
{
"name": "fe-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb",
"type": "Microsoft.Network/loadBalancers/frontendIPConfigurations",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"privateIPAddress": "10.0.1.4",
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"
},
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
],
"inboundNatRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"
}
]
}
}
],
"backendAddressPools": [
{
"name": "be-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb",
"type": "Microsoft.Network/loadBalancers/backendAddressPools",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"virtualNetwork": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb"
},
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
],
"syncMode": "Automatic"
}
}
],
"loadBalancingRules": [
{
"name": "rulelb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb",
"type": "Microsoft.Network/loadBalancers/loadBalancingRules",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 80,
"backendPort": 80,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp",
"loadDistribution": "Default",
"backendAddressPool": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"
},
"probe": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"
},
"disableOutboundSnat": false
}
}
],
"probes": [
{
"name": "probe-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb",
"type": "Microsoft.Network/loadBalancers/probes",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"protocol": "Http",
"port": 80,
"requestPath": "healthcheck.aspx",
"intervalInSeconds": 15,
"numberOfProbes": 2,
"probeThreshold": 1,
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
}
],
"inboundNatRules": [
{
"name": "in-nat-rule",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule",
"type": "Microsoft.Network/loadBalancers/inboundNatRules",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 3389,
"backendPort": 3389,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp"
}
}
],
"outboundRules": [],
"inboundNatPools": []
}
}
{
"name": "lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb",
"type": "Microsoft.Network/loadBalancers",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"location": "eastus",
"sku": {
"name": "Standard"
},
"properties": {
"provisioningState": "Succeeded",
"resourceGuid": "00000000-0000-0000-0000-00000000",
"frontendIPConfigurations": [
{
"name": "fe-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb",
"type": "Microsoft.Network/loadBalancers/frontendIPConfigurations",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"privateIPAddress": "10.0.1.4",
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb"
},
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
],
"inboundNatRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule"
}
]
}
}
],
"backendAddressPools": [
{
"name": "be-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb",
"type": "Microsoft.Network/loadBalancers/backendAddressPools",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"virtualNetwork": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb"
},
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
],
"syncMode": "Automatic"
}
}
],
"loadBalancingRules": [
{
"name": "rulelb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb",
"type": "Microsoft.Network/loadBalancers/loadBalancingRules",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 80,
"backendPort": 80,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp",
"loadDistribution": "Default",
"backendAddressPool": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"
},
"probe": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb"
},
"disableOutboundSnat": false
}
}
],
"probes": [
{
"name": "probe-lb",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb",
"type": "Microsoft.Network/loadBalancers/probes",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"protocol": "Http",
"port": 80,
"requestPath": "healthcheck.aspx",
"intervalInSeconds": 15,
"numberOfProbes": 2,
"probeThreshold": 1,
"loadBalancingRules": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/loadBalancingRules/rulelb"
}
]
}
}
],
"inboundNatRules": [
{
"name": "in-nat-rule",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatRules/in-nat-rule",
"type": "Microsoft.Network/loadBalancers/inboundNatRules",
"etag": "W/\"00000000-0000-0000-0000-00000000\"",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"
},
"frontendPort": 3389,
"backendPort": 3389,
"enableFloatingIP": true,
"idleTimeoutInMinutes": 15,
"protocol": "Tcp"
}
}
],
"outboundRules": [],
"inboundNatPools": []
}
}
定義
ApplicationGatewayBackendAddress
アプリケーション ゲートウェイのバックエンド アドレス。
名前 |
型 |
説明 |
fqdn
|
string
|
完全修飾ドメイン名 (FQDN)。
|
ipAddress
|
string
|
IPアドレス。
|
ApplicationGatewayBackendAddressPool
アプリケーション ゲートウェイのバックエンド アドレス プール。
名前 |
型 |
説明 |
etag
|
string
|
リソースが更新されるたびに変更される一意の読み取り専用文字列。
|
id
|
string
|
リソース ID。
|
name
|
string
|
Application Gateway 内で一意であるバックエンド アドレス プールの名前。
|
properties.backendAddresses
|
ApplicationGatewayBackendAddress[]
|
バックエンド アドレス。
|
properties.backendIPConfigurations
|
NetworkInterfaceIPConfiguration[]
|
ネットワーク インターフェイスで定義されている IP への参照のコレクション。
|
properties.provisioningState
|
ProvisioningState
|
バックエンド アドレス プール リソースのプロビジョニング状態。
|
type
|
string
|
リソースの種類。
|
ApplicationGatewayIPConfiguration
アプリケーション ゲートウェイの IP 構成。 現在、1 つのパブリック IP 構成と 1 つのプライベート IP 構成が許可されています。
名前 |
型 |
説明 |
etag
|
string
|
リソースが更新されるたびに変更される一意の読み取り専用文字列。
|
id
|
string
|
リソース ID。
|
name
|
string
|
Application Gateway 内で一意である IP 構成の名前。
|
properties.provisioningState
|
ProvisioningState
|
アプリケーション ゲートウェイ IP 構成リソースのプロビジョニング状態。
|
properties.subnet
|
SubResource
|
サブネット リソースへの参照。 アプリケーション ゲートウェイがプライベート アドレスを取得するサブネット。
|
type
|
string
|
リソースの種類。
|
ApplicationSecurityGroup
リソース グループ内のアプリケーション セキュリティ グループ。
名前 |
型 |
説明 |
etag
|
string
|
リソースが更新されるたびに変更される一意の読み取り専用文字列。
|
id
|
string
|
リソース ID。
|
location
|
string
|
リソースの場所。
|
name
|
string
|
リソース名。
|
properties.provisioningState
|
ProvisioningState
|
アプリケーション セキュリティ グループ リソースのプロビジョニング状態。
|
properties.resourceGuid
|
string
|
アプリケーション セキュリティ グループ リソースのリソース GUID プロパティ。 ユーザーが名前を変更したり、サブスクリプションまたはリソース グループ間でリソースを移行したりした場合でも、リソースを一意に識別します。
|
tags
|
object
|
リソース タグ。
|
type
|
string
|
リソースの種類。
|
AutoApproval
プライベート リンク サービスの自動承認リスト。
名前 |
型 |
説明 |
subscriptions
|
string[]
|
サブスクリプションの一覧。
|
BackendAddressPool
バックエンド IP アドレスのプール。
名前 |
型 |
説明 |
etag
|
string
|
リソースが更新されるたびに変更される一意の読み取り専用文字列。
|
id
|
string
|
リソース ID。
|
name
|
string
|
ロード バランサーによって使用されるバックエンド アドレス プールのセット内で一意であるリソースの名前。 この名前は、リソースへのアクセスに使用できます。
|
properties.backendIPConfigurations
|
NetworkInterfaceIPConfiguration[]
|
ネットワーク インターフェイスで定義されている IP アドレスへの参照の配列。
|
properties.drainPeriodInSeconds
|
integer
|
Load Balancer がクライアントとバックエンド アドレスに RESET を送信するまで待機する秒数。
|
properties.inboundNatRules
|
SubResource[]
|
このバックエンド アドレス プールを使用する受信 NAT 規則への参照の配列。
|
properties.loadBalancerBackendAddresses
|
LoadBalancerBackendAddress[]
|
バックエンド アドレスの配列。
|
properties.loadBalancingRules
|
SubResource[]
|
このバックエンド アドレス プールを使用する負荷分散規則への参照の配列。
|
properties.location
|
string
|
バックエンド アドレス プールの場所。
|
properties.outboundRule
|
SubResource
|
このバックエンド アドレス プールを使用する送信規則への参照。
|
properties.outboundRules
|
SubResource[]
|
このバックエンド アドレス プールを使用する送信規則への参照の配列。
|
properties.provisioningState
|
ProvisioningState
|
バックエンド アドレス プール リソースのプロビジョニング状態。
|
properties.syncMode
|
SyncMode
|
バックエンド プールのバックエンド アドレス同期モード
|
properties.tunnelInterfaces
|
GatewayLoadBalancerTunnelInterface[]
|
ゲートウェイ ロード バランサートンネル インターフェイスの配列。
|
properties.virtualNetwork
|
SubResource
|
仮想ネットワークへの参照。
|
type
|
string
|
リソースの種類。
|
CloudError
サービスからのエラー応答。
CloudErrorBody
サービスからのエラー応答。
名前 |
型 |
説明 |
code
|
string
|
エラーの識別子。 コードは不変であり、プログラムで使用することを目的としています。
|
details
|
CloudErrorBody[]
|
エラーに関する追加の詳細の一覧。
|
message
|
string
|
ユーザー インターフェイスでの表示に適したエラーを説明するメッセージ。
|
target
|
string
|
特定のエラーのターゲット。 たとえば、エラーが発生したプロパティの名前です。
|
顧客からのカスタム Dns 解決構成が含まれています。
名前 |
型 |
説明 |
fqdn
|
string
|
プライベート エンドポイントの IP アドレスに解決される Fqdn。
|
ipAddresses
|
string[]
|
プライベート エンドポイントのプライベート IP アドレスの一覧。
|
DdosSettings
パブリック IP の DDoS 保護設定が含まれています。
DdosSettingsProtectionMode
パブリック IP の DDoS 保護モード
名前 |
型 |
説明 |
Disabled
|
string
|
|
Enabled
|
string
|
|
VirtualNetworkInherited
|
string
|
|
Delegation
サブネットが委任されるサービスについて詳しく説明します。
名前 |
型 |
説明 |
etag
|
string
|
リソースが更新されるたびに変更される一意の読み取り専用文字列。
|
id
|
string
|
リソース ID。
|
name
|
string
|
サブネット内で一意のリソースの名前。 この名前は、リソースへのアクセスに使用できます。
|
properties.actions
|
string[]
|
委任時にサービスに対して許可されるアクション。
|
properties.provisioningState
|
ProvisioningState
|
サービス委任リソースのプロビジョニング状態。
|
properties.serviceName
|
string
|
サブネットを委任する必要があるサービスの名前 (Microsoft.Sql/servers など)。
|
type
|
string
|
リソースの種類。
|
DeleteOptions
パブリック IP アドレスを使用している VM が削除されたときの動作を指定する
名前 |
型 |
説明 |
Delete
|
string
|
|
Detach
|
string
|
|
ExtendedLocation
ExtendedLocation 複合型。
ExtendedLocationTypes
拡張された場所の型。
FlowLog
フロー ログ リソース。
名前 |
型 |
説明 |
etag
|
string
|
リソースが更新されるたびに変更される一意の読み取り専用文字列。
|
id
|
string
|
リソース ID。
|
identity
|
ManagedServiceIdentity
|
FlowLog リソースのマネージド ID
|
location
|
string
|
リソースの場所。
|
name
|
string
|
リソース名。
|
properties.enabled
|
boolean
|
フロー ログ記録を有効または無効にするフラグ。
|
properties.enabledFilteringCriteria
|
string
|
SrcIP、SrcPort、DstIP、DstPort、Protocol、Encryption、Direction、Action に基づいてネットワーク トラフィック ログをフィルター処理するオプションのフィールド。 指定しない場合、すべてのネットワーク トラフィックがログに記録されます。
|
properties.flowAnalyticsConfiguration
|
TrafficAnalyticsProperties
|
トラフィック分析の構成を定義するパラメーター。
|
properties.format
|
FlowLogFormatParameters
|
フロー ログ形式を定義するパラメーター。
|
properties.provisioningState
|
ProvisioningState
|
フロー ログのプロビジョニング状態。
|
properties.retentionPolicy
|
RetentionPolicyParameters
|
フロー ログの保持ポリシーを定義するパラメーター。
|
properties.storageId
|
string
|
フロー ログの格納に使用されるストレージ アカウントの ID。
|
properties.targetResourceGuid
|
string
|
フロー ログが適用されるネットワーク セキュリティ グループの GUID。
|
properties.targetResourceId
|
string
|
フロー ログが適用されるネットワーク セキュリティ グループの ID。
|
tags
|
object
|
リソース タグ。
|
type
|
string
|
リソースの種類。
|
フロー ログ形式を定義するパラメーター。
名前 |
型 |
規定値 |
説明 |
type
|
FlowLogFormatType
|
|
フロー ログのファイルの種類。
|
version
|
integer
|
0
|
フロー ログのバージョン (リビジョン)。
|
フロー ログのファイルの種類。
FrontendIPConfiguration
ロード バランサーのフロントエンド IP アドレス。
名前 |
型 |
説明 |
etag
|
string
|
リソースが更新されるたびに変更される一意の読み取り専用文字列。
|
id
|
string
|
リソース ID。
|
name
|
string
|
ロード バランサーによって使用されるフロントエンド IP 構成のセット内で一意であるリソースの名前。 この名前は、リソースへのアクセスに使用できます。
|
properties.gatewayLoadBalancer
|
SubResource
|
ゲートウェイ ロード バランサーのフロントエンド IP への参照。
|
properties.inboundNatPools
|
SubResource[]
|
このフロントエンド IP を使用する受信プールへの参照の配列。
|
properties.inboundNatRules
|
SubResource[]
|
このフロントエンド IP を使用する受信規則への参照の配列。
|
properties.loadBalancingRules
|
SubResource[]
|
このフロントエンド IP を使用する負荷分散規則への参照の配列。
|
properties.outboundRules
|
SubResource[]
|
このフロントエンド IP を使用する送信規則への参照の配列。
|
properties.privateIPAddress
|
string
|
IP 構成のプライベート IP アドレス。
|
properties.privateIPAddressVersion
|
IPVersion
|
特定の ipconfiguration が IPv4 か IPv6 か。 既定値は IPv4 と見なされます。
|
properties.privateIPAllocationMethod
|
IPAllocationMethod
|
プライベート IP 割り当て方法。
|
properties.provisioningState
|
ProvisioningState
|
フロントエンド IP 構成リソースのプロビジョニング状態。
|
properties.publicIPAddress
|
PublicIPAddress
|
パブリック IP リソースへの参照。
|
properties.publicIPPrefix
|
SubResource
|
パブリック IP プレフィックス リソースへの参照。
|
properties.subnet
|
Subnet
|
サブネット リソースへの参照。
|
type
|
string
|
リソースの種類。
|
zones
|
string[]
|
リソースに割り当てられた IP を示す可用性ゾーンの一覧が必要です。
|
GatewayLoadBalancerTunnelInterface
ロード バランサー バックエンド アドレス プールのゲートウェイ ロード バランサー トンネル インターフェイス。
GatewayLoadBalancerTunnelInterfaceType
ゲートウェイ ロード バランサートンネル インターフェイスのトラフィックの種類。
名前 |
型 |
説明 |
External
|
string
|
|
Internal
|
string
|
|
None
|
string
|
|
GatewayLoadBalancerTunnelProtocol
ゲートウェイ ロード バランサートンネル インターフェイスのプロトコル。
名前 |
型 |
説明 |
Native
|
string
|
|
None
|
string
|
|
VXLAN
|
string
|
|
InboundNatPool
ロード バランサーの受信 NAT プール。
名前 |
型 |
説明 |
etag
|
string
|
リソースが更新されるたびに変更される一意の読み取り専用文字列。
|
id
|
string
|
リソース ID。
|
name
|
string
|
ロード バランサーによって使用される受信 NAT プールのセット内で一意であるリソースの名前。 この名前は、リソースへのアクセスに使用できます。
|
properties.backendPort
|
integer
|
エンドポイントの内部接続に使用されるポート。 使用できる値は 1 ~ 65535 です。
|
properties.enableFloatingIP
|
boolean
|
SQL AlwaysOn 可用性グループを構成するために必要なフローティング IP 機能用に仮想マシンのエンドポイントを構成します。 この設定は、SQL Server で SQL AlwaysOn 可用性グループを使用する場合に必要です。 エンドポイントを作成した後は、この設定を変更できません。
|
properties.enableTcpReset
|
boolean
|
TCP フローのアイドル タイムアウトまたは予期しない接続終了時に双方向 TCP リセットを受信します。 この要素は、プロトコルが TCP に設定されている場合にのみ使用されます。
|
properties.frontendIPConfiguration
|
SubResource
|
フロントエンド IP アドレスへの参照。
|
properties.frontendPortRangeEnd
|
integer
|
ロード バランサーに関連付けられている NIC に受信 Nat を提供するために使用される外部ポートの範囲内の最後のポート番号。 使用できる値の範囲は 1 ~ 65535 です。
|
properties.frontendPortRangeStart
|
integer
|
ロード バランサーに関連付けられている NIC に受信 Nat を提供するために使用される外部ポートの範囲内の最初のポート番号。 使用できる値の範囲は 1 ~ 65534 です。
|
properties.idleTimeoutInMinutes
|
integer
|
TCP アイドル接続のタイムアウト。 値は 4 ~ 30 分の間で設定できます。 既定値は 4 分です。 この要素は、プロトコルが TCP に設定されている場合にのみ使用されます。
|
properties.protocol
|
TransportProtocol
|
受信 NAT プールで使用されるトランスポート プロトコルへの参照。
|
properties.provisioningState
|
ProvisioningState
|
受信 NAT プール リソースのプロビジョニング状態。
|
type
|
string
|
リソースの種類。
|
InboundNatRule
ロード バランサーの受信 NAT 規則。
名前 |
型 |
説明 |
etag
|
string
|
リソースが更新されるたびに変更される一意の読み取り専用文字列。
|
id
|
string
|
リソース ID。
|
name
|
string
|
ロード バランサーによって使用される受信 NAT 規則のセット内で一意であるリソースの名前。 この名前は、リソースへのアクセスに使用できます。
|
properties.backendAddressPool
|
SubResource
|
backendAddressPool リソースへの参照。
|
properties.backendIPConfiguration
|
NetworkInterfaceIPConfiguration
|
VM のネットワーク インターフェイスで定義されているプライベート IP アドレスへの参照。 各フロントエンド IP 構成のフロントエンド ポートに送信されたトラフィックは、バックエンド IP に転送されます。
|
properties.backendPort
|
integer
|
内部エンドポイントに使用されるポート。 使用できる値の範囲は 1 ~ 65535 です。
|
properties.enableFloatingIP
|
boolean
|
SQL AlwaysOn 可用性グループを構成するために必要なフローティング IP 機能用に仮想マシンのエンドポイントを構成します。 この設定は、SQL Server で SQL AlwaysOn 可用性グループを使用する場合に必要です。 エンドポイントを作成した後は、この設定を変更できません。
|
properties.enableTcpReset
|
boolean
|
TCP フローのアイドル タイムアウトまたは予期しない接続終了時に双方向 TCP リセットを受信します。 この要素は、プロトコルが TCP に設定されている場合にのみ使用されます。
|
properties.frontendIPConfiguration
|
SubResource
|
フロントエンド IP アドレスへの参照。
|
properties.frontendPort
|
integer
|
外部エンドポイントのポート。 各規則のポート番号は、ロード バランサー内で一意である必要があります。 使用可能な値の範囲は 1 ~ 65534 です。
|
properties.frontendPortRangeEnd
|
integer
|
外部エンドポイントのポート範囲の端。 このプロパティは、BackendAddressPool と FrontendPortRangeStart と共に使用されます。 BackendAddressPool からのバックエンド アドレスごとに、個々の受信 NAT 規則ポート マッピングが作成されます。 使用可能な値の範囲は 1 ~ 65534 です。
|
properties.frontendPortRangeStart
|
integer
|
外部エンドポイントのポート範囲の開始。 このプロパティは、BackendAddressPool と FrontendPortRangeEnd と共に使用されます。 BackendAddressPool からのバックエンド アドレスごとに、個々の受信 NAT 規則ポート マッピングが作成されます。 使用可能な値の範囲は 1 ~ 65534 です。
|
properties.idleTimeoutInMinutes
|
integer
|
TCP アイドル接続のタイムアウト。 値は 4 ~ 30 分の間で設定できます。 既定値は 4 分です。 この要素は、プロトコルが TCP に設定されている場合にのみ使用されます。
|
properties.protocol
|
TransportProtocol
|
負荷分散規則で使用されるトランスポート プロトコルへの参照。
|
properties.provisioningState
|
ProvisioningState
|
受信 NAT 規則リソースのプロビジョニング状態。
|
type
|
string
|
リソースの種類。
|
IPAllocationMethod
IP アドレスの割り当て方法。
名前 |
型 |
説明 |
Dynamic
|
string
|
|
Static
|
string
|
|
IpamPoolPrefixAllocation
IpamPool プレフィックス割り当てリファレンス。
名前 |
型 |
説明 |
allocatedAddressPrefixes
|
string[]
|
関連付けられたリソースの IpamPool に割り当てられた IP アドレス プレフィックスの一覧。
|
numberOfIpAddresses
|
string
|
割り当てる IP アドレスの数。
|
pool.id
|
string
|
関連付けられている Azure IpamPool リソースのリソース ID。
|
IPConfiguration
IP 構成。
名前 |
型 |
規定値 |
説明 |
etag
|
string
|
|
リソースが更新されるたびに変更される一意の読み取り専用文字列。
|
id
|
string
|
|
リソース ID。
|
name
|
string
|
|
リソース グループ内で一意であるリソースの名前。 この名前は、リソースへのアクセスに使用できます。
|
properties.privateIPAddress
|
string
|
|
IP 構成のプライベート IP アドレス。
|
properties.privateIPAllocationMethod
|
IPAllocationMethod
|
Dynamic
|
プライベート IP アドレスの割り当て方法。
|
properties.provisioningState
|
ProvisioningState
|
|
IP 構成リソースのプロビジョニング状態。
|
properties.publicIPAddress
|
PublicIPAddress
|
|
パブリック IP リソースへの参照。
|
properties.subnet
|
Subnet
|
|
サブネット リソースへの参照。
|
IPConfigurationProfile
IP 構成プロファイルの子リソース。
名前 |
型 |
説明 |
etag
|
string
|
リソースが更新されるたびに変更される一意の読み取り専用文字列。
|
id
|
string
|
リソース ID。
|
name
|
string
|
リソースの名前。 この名前は、リソースへのアクセスに使用できます。
|
properties.provisioningState
|
ProvisioningState
|
IP 構成プロファイル リソースのプロビジョニング状態。
|
properties.subnet
|
Subnet
|
コンテナー ネットワーク インターフェイスの IP 構成を作成するためのサブネット リソースへの参照。
|
type
|
string
|
サブ リソースの種類。
|
IpTag
オブジェクトに関連付けられている IpTag を格納します。
名前 |
型 |
説明 |
ipTagType
|
string
|
IP タグの種類。 例: FirstPartyUsage。
|
tag
|
string
|
パブリック IP に関連付けられている IP タグの値。 例: SQL。
|
IPVersion
IP アドレスのバージョン。
名前 |
型 |
説明 |
IPv4
|
string
|
|
IPv6
|
string
|
|
LoadBalancer
LoadBalancer リソース。
名前 |
型 |
説明 |
etag
|
string
|
リソースが更新されるたびに変更される一意の読み取り専用文字列。
|
extendedLocation
|
ExtendedLocation
|
ロード バランサーの拡張された場所。
|
id
|
string
|
リソース ID。
|
location
|
string
|
リソースの場所。
|
name
|
string
|
リソース名。
|
properties.backendAddressPools
|
BackendAddressPool[]
|
ロード バランサーによって使用されるバックエンド アドレス プールのコレクション。
|
properties.frontendIPConfigurations
|
FrontendIPConfiguration[]
|
ロード バランサーに使用するフロントエンド IP を表すオブジェクト。
|
properties.inboundNatPools
|
InboundNatPool[]
|
ロード バランサーに関連付けられている NIC 上の単一のバックエンド ポートへの受信 NAT の外部ポート範囲を定義します。 受信 NAT 規則は、ロード バランサーに関連付けられている NIC ごとに、この範囲の外部ポートを使用して自動的に作成されます。 ロード バランサーで受信 NAT プールを定義することは、受信 NAT 規則の定義と相互に排他的です。 受信 NAT プールは、仮想マシン スケール セットから参照されます。 個々の仮想マシンに関連付けられている NIC は、受信 NAT プールを参照できません。 個々の受信 NAT 規則を参照する必要があります。
|
properties.inboundNatRules
|
InboundNatRule[]
|
ロード バランサーによって使用される受信 NAT 規則のコレクション。 ロード バランサーでの受信 NAT 規則の定義は、受信 NAT プールの定義と相互に排他的です。 受信 NAT プールは、仮想マシン スケール セットから参照されます。 個々の仮想マシンに関連付けられている NIC は、受信 NAT プールを参照できません。 個々の受信 NAT 規則を参照する必要があります。
|
properties.loadBalancingRules
|
LoadBalancingRule[]
|
負荷分散規則を表すオブジェクト コレクション プロビジョニングを取得します。
|
properties.outboundRules
|
OutboundRule[]
|
送信規則。
|
properties.probes
|
Probe[]
|
ロード バランサーで使用されるプローブ オブジェクトのコレクション。
|
properties.provisioningState
|
ProvisioningState
|
ロード バランサー リソースのプロビジョニング状態。
|
properties.resourceGuid
|
string
|
ロード バランサー リソースのリソース GUID プロパティ。
|
sku
|
LoadBalancerSku
|
ロード バランサー SKU。
|
tags
|
object
|
リソース タグ。
|
type
|
string
|
リソースの種類。
|
LoadBalancerBackendAddress
ロード バランサーのバックエンド アドレス。
名前 |
型 |
説明 |
name
|
string
|
バックエンド アドレスの名前。
|
properties.adminState
|
LoadBalancerBackendAddressAdminState
|
Load Balancer が常に新しい接続をバックエンドに転送したり、新しい接続を拒否して既存の接続をリセットしたりできるように、一度設定すると正常性プローブをオーバーライドできる管理状態の一覧。
|
properties.inboundNatRulesPortMapping
|
NatRulePortMapping[]
|
受信 NAT 規則ポート マッピングのコレクション。
|
properties.ipAddress
|
string
|
参照先の仮想ネットワークに属する IP アドレス。
|
properties.loadBalancerFrontendIPConfiguration
|
SubResource
|
リージョンのロードバランスで定義されているフロントエンド IP アドレス構成への参照。
|
properties.networkInterfaceIPConfiguration
|
SubResource
|
ネットワーク インターフェイスで定義されている IP アドレスへの参照。
|
properties.subnet
|
SubResource
|
既存のサブネットへの参照。
|
properties.virtualNetwork
|
SubResource
|
既存の仮想ネットワークへの参照。
|
LoadBalancerBackendAddressAdminState
Load Balancer が常に新しい接続をバックエンドに転送したり、新しい接続を拒否して既存の接続をリセットしたりできるように、一度設定すると正常性プローブをオーバーライドできる管理状態の一覧。
名前 |
型 |
説明 |
Down
|
string
|
|
None
|
string
|
|
Up
|
string
|
|
LoadBalancerOutboundRuleProtocol
ロード バランサーの送信規則のプロトコル。
名前 |
型 |
説明 |
All
|
string
|
|
Tcp
|
string
|
|
Udp
|
string
|
|
LoadBalancerSku
ロード バランサーの SKU。
LoadBalancerSkuName
ロード バランサー SKU の名前。
名前 |
型 |
説明 |
Basic
|
string
|
|
Gateway
|
string
|
|
Standard
|
string
|
|
LoadBalancerSkuTier
ロード バランサー SKU の層。
名前 |
型 |
説明 |
Global
|
string
|
|
Regional
|
string
|
|
LoadBalancingRule
ロード バランサーの負荷分散規則。
名前 |
型 |
説明 |
etag
|
string
|
リソースが更新されるたびに変更される一意の読み取り専用文字列。
|
id
|
string
|
リソース ID。
|
name
|
string
|
ロード バランサーによって使用される負荷分散規則のセット内で一意であるリソースの名前。 この名前は、リソースへのアクセスに使用できます。
|
properties.backendAddressPool
|
SubResource
|
DIP のプールへの参照。 受信トラフィックは、バックエンド IP 内の IP 間でランダムに負荷分散されます。
|
properties.backendAddressPools
|
SubResource[]
|
DIP のプールへの参照の配列。
|
properties.backendPort
|
integer
|
エンドポイントの内部接続に使用されるポート。 使用できる値は 0 ~ 65535 です。 値 0 では "任意のポート" が有効になります。
|
properties.disableOutboundSnat
|
boolean
|
負荷分散規則のフロントエンドで指定されたパブリック IP アドレスを使用するように、バックエンド プール内の VM の SNAT を構成します。
|
properties.enableFloatingIP
|
boolean
|
SQL AlwaysOn 可用性グループを構成するために必要なフローティング IP 機能用に仮想マシンのエンドポイントを構成します。 この設定は、SQL Server で SQL AlwaysOn 可用性グループを使用する場合に必要です。 エンドポイントを作成した後は、この設定を変更できません。
|
properties.enableTcpReset
|
boolean
|
TCP フローのアイドル タイムアウトまたは予期しない接続終了時に双方向 TCP リセットを受信します。 この要素は、プロトコルが TCP に設定されている場合にのみ使用されます。
|
properties.frontendIPConfiguration
|
SubResource
|
フロントエンド IP アドレスへの参照。
|
properties.frontendPort
|
integer
|
外部エンドポイントのポート。 各規則のポート番号は、ロード バランサー内で一意である必要があります。 使用できる値は 0 ~ 65534 です。 値 0 では "任意のポート" が有効になります。
|
properties.idleTimeoutInMinutes
|
integer
|
TCP アイドル接続のタイムアウト。 値は 4 ~ 30 分の間で設定できます。 既定値は 4 分です。 この要素は、プロトコルが TCP に設定されている場合にのみ使用されます。
|
properties.loadDistribution
|
LoadDistribution
|
この規則の負荷分散ポリシー。
|
properties.probe
|
SubResource
|
負荷分散規則で使用されるロード バランサー プローブへの参照。
|
properties.protocol
|
TransportProtocol
|
負荷分散規則で使用されるトランスポート プロトコルへの参照。
|
properties.provisioningState
|
ProvisioningState
|
負荷分散規則リソースのプロビジョニング状態。
|
type
|
string
|
リソースの種類。
|
LoadDistribution
この規則の負荷分散ポリシー。
名前 |
型 |
説明 |
Default
|
string
|
|
SourceIP
|
string
|
|
SourceIPProtocol
|
string
|
|
ManagedServiceIdentity
リソースの ID。
名前 |
型 |
説明 |
principalId
|
string
|
システム割り当て ID のプリンシパル ID。 このプロパティは、システム割り当て ID にのみ提供されます。
|
tenantId
|
string
|
システム割り当て ID のテナント ID。 このプロパティは、システム割り当て ID にのみ提供されます。
|
type
|
ResourceIdentityType
|
リソースに使用される ID の種類。 型 'SystemAssigned, UserAssigned' には、暗黙的に作成された ID とユーザー割り当て ID のセットの両方が含まれます。 種類 'None' は、仮想マシンからすべての ID を削除します。
|
userAssignedIdentities
|
UserAssignedIdentities
|
リソースに関連付けられているユーザー ID の一覧。 ユーザー ID ディクショナリ のキー参照は、'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}' という形式の ARM リソース ID になります。
|
NatGateway
Nat Gateway リソース。
名前 |
型 |
説明 |
etag
|
string
|
リソースが更新されるたびに変更される一意の読み取り専用文字列。
|
id
|
string
|
リソース ID。
|
location
|
string
|
リソースの場所。
|
name
|
string
|
リソース名。
|
properties.idleTimeoutInMinutes
|
integer
|
nat ゲートウェイのアイドル タイムアウト。
|
properties.provisioningState
|
ProvisioningState
|
NAT ゲートウェイ リソースのプロビジョニング状態。
|
properties.publicIpAddresses
|
SubResource[]
|
nat ゲートウェイ リソースに関連付けられているパブリック IP アドレスの配列。
|
properties.publicIpPrefixes
|
SubResource[]
|
nat ゲートウェイ リソースに関連付けられているパブリック IP プレフィックスの配列。
|
properties.resourceGuid
|
string
|
NAT ゲートウェイ リソースのリソース GUID プロパティ。
|
properties.subnets
|
SubResource[]
|
この nat ゲートウェイ リソースを使用するサブネットへの参照の配列。
|
sku
|
NatGatewaySku
|
NAT ゲートウェイ SKU。
|
tags
|
object
|
リソース タグ。
|
type
|
string
|
リソースの種類。
|
zones
|
string[]
|
Nat Gateway をデプロイする必要があるゾーンを示す可用性ゾーンの一覧。
|
NatGatewaySku
NAT ゲートウェイの SKU。
NatGatewaySkuName
Nat Gateway SKU の名前。
NatRulePortMapping
バックエンド プール用に作成された受信 NAT 規則の個々のポート マッピング。
名前 |
型 |
説明 |
backendPort
|
integer
|
バックエンド ポート。
|
frontendPort
|
integer
|
フロントエンド ポート。
|
inboundNatRuleName
|
string
|
受信 NAT 規則の名前。
|
NetworkInterface
リソース グループ内のネットワーク インターフェイス。
名前 |
型 |
説明 |
etag
|
string
|
リソースが更新されるたびに変更される一意の読み取り専用文字列。
|
extendedLocation
|
ExtendedLocation
|
ネットワーク インターフェイスの拡張された場所。
|
id
|
string
|
リソース ID。
|
location
|
string
|
リソースの場所。
|
name
|
string
|
リソース名。
|
properties.auxiliaryMode
|
NetworkInterfaceAuxiliaryMode
|
ネットワーク インターフェイス リソースの補助モード。
|
properties.auxiliarySku
|
NetworkInterfaceAuxiliarySku
|
ネットワーク インターフェイス リソースの補助 SKU。
|
properties.defaultOutboundConnectivityEnabled
|
boolean
|
nic の既定の送信接続が構成されたかどうか。
|
properties.disableTcpStateTracking
|
boolean
|
TCP 状態追跡を無効にするかどうかを示します。
|
properties.dnsSettings
|
NetworkInterfaceDnsSettings
|
ネットワーク インターフェイスの DNS 設定。
|
properties.dscpConfiguration
|
SubResource
|
ネットワーク インターフェイスがリンクされている dscp 構成への参照。
|
properties.enableAcceleratedNetworking
|
boolean
|
ネットワーク インターフェイスが高速ネットワーク用に構成されている場合。 高速ネットワークを必要とする VM サイズには適用されません。
|
properties.enableIPForwarding
|
boolean
|
このネットワーク インターフェイスで IP 転送が有効になっているかどうかを示します。
|
properties.hostedWorkloads
|
string[]
|
リンクされた BareMetal リソースへの参照の一覧。
|
properties.ipConfigurations
|
NetworkInterfaceIPConfiguration[]
|
ネットワーク インターフェイスの IPConfigurations の一覧。
|
properties.macAddress
|
string
|
ネットワーク インターフェイスの MAC アドレス。
|
properties.migrationPhase
|
NetworkInterfaceMigrationPhase
|
ネットワーク インターフェイス リソースの移行フェーズ。
|
properties.networkSecurityGroup
|
NetworkSecurityGroup
|
NetworkSecurityGroup リソースへの参照。
|
properties.nicType
|
NetworkInterfaceNicType
|
ネットワーク インターフェイス リソースの種類。
|
properties.primary
|
boolean
|
これが仮想マシン上のプライマリ ネットワーク インターフェイスであるかどうか。
|
properties.privateEndpoint
|
PrivateEndpoint
|
ネットワーク インターフェイスがリンクされているプライベート エンドポイントへの参照。
|
properties.privateLinkService
|
PrivateLinkService
|
ネットワーク インターフェイス リソースの Privatelinkservice。
|
properties.provisioningState
|
ProvisioningState
|
ネットワーク インターフェイス リソースのプロビジョニング状態。
|
properties.resourceGuid
|
string
|
ネットワーク インターフェイス リソースのリソース GUID プロパティ。
|
properties.tapConfigurations
|
NetworkInterfaceTapConfiguration[]
|
ネットワーク インターフェイスの TapConfigurations の一覧。
|
properties.virtualMachine
|
SubResource
|
仮想マシンへの参照。
|
properties.vnetEncryptionSupported
|
boolean
|
この NIC が接続されている仮想マシンが暗号化をサポートしているかどうか。
|
properties.workloadType
|
string
|
BareMetal リソースの NetworkInterface の WorkloadType
|
tags
|
object
|
リソース タグ。
|
type
|
string
|
リソースの種類。
|
NetworkInterfaceAuxiliaryMode
ネットワーク インターフェイス リソースの補助モード。
名前 |
型 |
説明 |
AcceleratedConnections
|
string
|
|
Floating
|
string
|
|
MaxConnections
|
string
|
|
None
|
string
|
|
NetworkInterfaceAuxiliarySku
ネットワーク インターフェイス リソースの補助 SKU。
名前 |
型 |
説明 |
A1
|
string
|
|
A2
|
string
|
|
A4
|
string
|
|
A8
|
string
|
|
None
|
string
|
|
NetworkInterfaceDnsSettings
ネットワーク インターフェイスの DNS 設定。
名前 |
型 |
説明 |
appliedDnsServers
|
string[]
|
この NIC を使用する VM が可用性セットの一部である場合、この一覧には、可用性セットの一部であるすべての NIC のすべての DNS サーバーの和集合が含まれます。 このプロパティは、これらの各 VM で構成されます。
|
dnsServers
|
string[]
|
DNS サーバーの IP アドレスの一覧。 Azure 提供の DNS 解決に切り替えるには、"AzureProvidedDNS" を使用します。 'AzureProvidedDNS' の値を他の IP と組み合わせることはできません。dnsServers コレクション内の唯一の値である必要があります。
|
internalDnsNameLabel
|
string
|
同じ仮想ネットワーク内の VM 間の内部通信に使用される、この NIC の相対 DNS 名。
|
internalDomainNameSuffix
|
string
|
internalDnsNameLabel が指定されていない場合でも、VM のプライマリ NIC に対して DNS エントリが作成されます。 この DNS 名は、VM 名と internalDomainNameSuffix の値を連結することで構築できます。
|
internalFqdn
|
string
|
同じ仮想ネットワーク内の VM 間の内部通信をサポートする完全修飾 DNS 名。
|
NetworkInterfaceIPConfiguration
ネットワーク インターフェイスの IPConfiguration。
名前 |
型 |
説明 |
etag
|
string
|
リソースが更新されるたびに変更される一意の読み取り専用文字列。
|
id
|
string
|
リソース ID。
|
name
|
string
|
リソース グループ内で一意であるリソースの名前。 この名前は、リソースへのアクセスに使用できます。
|
properties.applicationGatewayBackendAddressPools
|
ApplicationGatewayBackendAddressPool[]
|
ApplicationGatewayBackendAddressPool リソースへの参照。
|
properties.applicationSecurityGroups
|
ApplicationSecurityGroup[]
|
IP 構成が含まれるアプリケーション セキュリティ グループ。
|
properties.gatewayLoadBalancer
|
SubResource
|
ゲートウェイ ロード バランサーのフロントエンド IP への参照。
|
properties.loadBalancerBackendAddressPools
|
BackendAddressPool[]
|
LoadBalancerBackendAddressPool リソースへの参照。
|
properties.loadBalancerInboundNatRules
|
InboundNatRule[]
|
LoadBalancerInboundNatRules の参照の一覧。
|
properties.primary
|
boolean
|
これがネットワーク インターフェイスの主要な顧客アドレスであるかどうか。
|
properties.privateIPAddress
|
string
|
IP 構成のプライベート IP アドレス。 1 つの IP アドレスまたは CIDR ブロックを形式で指定できます。 /.
|
properties.privateIPAddressPrefixLength
|
integer
|
プライベート IP アドレスプレフィックスの長さ。 指定され、割り当て方法が動的な場合、サービスは 1 つの IP アドレスではなく CIDR ブロックを割り当てます。
|
properties.privateIPAddressVersion
|
IPVersion
|
特定の IP 構成が IPv4 か IPv6 か。 既定値は IPv4 です。
|
properties.privateIPAllocationMethod
|
IPAllocationMethod
|
プライベート IP アドレスの割り当て方法。
|
properties.privateLinkConnectionProperties
|
NetworkInterfaceIPConfigurationPrivateLinkConnectionProperties
|
ネットワーク インターフェイスの PrivateLinkConnection プロパティ。
|
properties.provisioningState
|
ProvisioningState
|
ネットワーク インターフェイス IP 構成のプロビジョニング状態。
|
properties.publicIPAddress
|
PublicIPAddress
|
IP 構成にバインドされたパブリック IP アドレス。
|
properties.subnet
|
Subnet
|
IP 構成にバインドされたサブネット。
|
properties.virtualNetworkTaps
|
VirtualNetworkTap[]
|
仮想ネットワーク タップへの参照。
|
type
|
string
|
リソースの種類。
|
NetworkInterfaceIPConfigurationPrivateLinkConnectionProperties
ネットワーク インターフェイスの PrivateLinkConnection プロパティ。
名前 |
型 |
説明 |
fqdns
|
string[]
|
現在のプライベート リンク接続の FQDN の一覧。
|
groupId
|
string
|
現在のプライベート リンク接続のグループ ID。
|
requiredMemberName
|
string
|
現在のプライベート リンク接続に必要なメンバー名。
|
NetworkInterfaceMigrationPhase
ネットワーク インターフェイス リソースの移行フェーズ。
名前 |
型 |
説明 |
Abort
|
string
|
|
Commit
|
string
|
|
Committed
|
string
|
|
None
|
string
|
|
Prepare
|
string
|
|
NetworkInterfaceNicType
ネットワーク インターフェイス リソースの種類。
名前 |
型 |
説明 |
Elastic
|
string
|
|
Standard
|
string
|
|
NetworkInterfaceTapConfiguration
ネットワーク インターフェイスの [構成] をタップします。
名前 |
型 |
説明 |
etag
|
string
|
リソースが更新されるたびに変更される一意の読み取り専用文字列。
|
id
|
string
|
リソース ID。
|
name
|
string
|
リソース グループ内で一意であるリソースの名前。 この名前は、リソースへのアクセスに使用できます。
|
properties.provisioningState
|
ProvisioningState
|
ネットワーク インターフェイス タップ構成リソースのプロビジョニング状態。
|
properties.virtualNetworkTap
|
VirtualNetworkTap
|
Virtual Network Tap リソースへの参照。
|
type
|
string
|
サブ リソースの種類。
|
NetworkSecurityGroup
NetworkSecurityGroup リソース。
名前 |
型 |
説明 |
etag
|
string
|
リソースが更新されるたびに変更される一意の読み取り専用文字列。
|
id
|
string
|
リソース ID。
|
location
|
string
|
リソースの場所。
|
name
|
string
|
リソース名。
|
properties.defaultSecurityRules
|
SecurityRule[]
|
ネットワーク セキュリティ グループの既定のセキュリティ規則。
|
properties.flowLogs
|
FlowLog[]
|
フロー ログ リソースへの参照のコレクション。
|
properties.flushConnection
|
boolean
|
有効にすると、ルールが更新されると、ネットワーク セキュリティ グループ接続から作成されたフローが再評価されます。 初期有効化によって、再評価がトリガーされます。
|
properties.networkInterfaces
|
NetworkInterface[]
|
ネットワーク インターフェイスへの参照のコレクション。
|
properties.provisioningState
|
ProvisioningState
|
ネットワーク セキュリティ グループ リソースのプロビジョニング状態。
|
properties.resourceGuid
|
string
|
ネットワーク セキュリティ グループ リソースのリソース GUID プロパティ。
|
properties.securityRules
|
SecurityRule[]
|
ネットワーク セキュリティ グループのセキュリティ規則のコレクション。
|
properties.subnets
|
Subnet[]
|
サブネットへの参照のコレクション。
|
tags
|
object
|
リソース タグ。
|
type
|
string
|
リソースの種類。
|
OutboundRule
ロード バランサーの送信規則。
名前 |
型 |
説明 |
etag
|
string
|
リソースが更新されるたびに変更される一意の読み取り専用文字列。
|
id
|
string
|
リソース ID。
|
name
|
string
|
ロード バランサーによって使用される送信規則のセット内で一意であるリソースの名前。 この名前は、リソースへのアクセスに使用できます。
|
properties.allocatedOutboundPorts
|
integer
|
NAT に使用する送信ポートの数。
|
properties.backendAddressPool
|
SubResource
|
DIP のプールへの参照。 送信トラフィックは、バックエンド IP 内の IP 間でランダムに負荷分散されます。
|
properties.enableTcpReset
|
boolean
|
TCP フローのアイドル タイムアウトまたは予期しない接続終了時に双方向 TCP リセットを受信します。 この要素は、プロトコルが TCP に設定されている場合にのみ使用されます。
|
properties.frontendIPConfigurations
|
SubResource[]
|
ロード バランサーのフロントエンド IP アドレス。
|
properties.idleTimeoutInMinutes
|
integer
|
TCP アイドル接続のタイムアウト。
|
properties.protocol
|
LoadBalancerOutboundRuleProtocol
|
ロード バランサーの送信規則のプロトコル。
|
properties.provisioningState
|
ProvisioningState
|
送信ルール リソースのプロビジョニング状態。
|
type
|
string
|
リソースの種類。
|
PrivateEndpoint
プライベート エンドポイント リソース。
名前 |
型 |
説明 |
etag
|
string
|
リソースが更新されるたびに変更される一意の読み取り専用文字列。
|
extendedLocation
|
ExtendedLocation
|
ロード バランサーの拡張された場所。
|
id
|
string
|
リソース ID。
|
location
|
string
|
リソースの場所。
|
name
|
string
|
リソース名。
|
properties.applicationSecurityGroups
|
ApplicationSecurityGroup[]
|
プライベート エンドポイントの IP 構成が含まれるアプリケーション セキュリティ グループ。
|
properties.customDnsConfigs
|
CustomDnsConfigPropertiesFormat[]
|
カスタム DNS 構成の配列。
|
properties.customNetworkInterfaceName
|
string
|
プライベート エンドポイントに接続されているネットワーク インターフェイスのカスタム名。
|
properties.ipConfigurations
|
PrivateEndpointIPConfiguration[]
|
プライベート エンドポイントの IP 構成の一覧。 これは、ファースト パーティ サービスのエンドポイントにマップするために使用されます。
|
properties.manualPrivateLinkServiceConnections
|
PrivateLinkServiceConnection[]
|
リモート リソースへの接続に関する情報のグループ。 ネットワーク管理者がリモート リソースへの接続を承認するアクセス権を持っていない場合に使用されます。
|
properties.networkInterfaces
|
NetworkInterface[]
|
このプライベート エンドポイント用に作成されたネットワーク インターフェイスへの参照の配列。
|
properties.privateLinkServiceConnections
|
PrivateLinkServiceConnection[]
|
リモート リソースへの接続に関する情報のグループ。
|
properties.provisioningState
|
ProvisioningState
|
プライベート エンドポイント リソースのプロビジョニング状態。
|
properties.subnet
|
Subnet
|
プライベート IP の割り当て元となるサブネットの ID。
|
tags
|
object
|
リソース タグ。
|
type
|
string
|
リソースの種類。
|
PrivateEndpointConnection
PrivateEndpointConnection リソース。
名前 |
型 |
説明 |
etag
|
string
|
リソースが更新されるたびに変更される一意の読み取り専用文字列。
|
id
|
string
|
リソース ID。
|
name
|
string
|
リソース グループ内で一意であるリソースの名前。 この名前は、リソースへのアクセスに使用できます。
|
properties.linkIdentifier
|
string
|
コンシューマー リンク ID。
|
properties.privateEndpoint
|
PrivateEndpoint
|
プライベート エンドポイントのリソース。
|
properties.privateEndpointLocation
|
string
|
プライベート エンドポイントの場所。
|
properties.privateLinkServiceConnectionState
|
PrivateLinkServiceConnectionState
|
サービス コンシューマーとプロバイダー間の接続の状態に関する情報のコレクション。
|
properties.provisioningState
|
ProvisioningState
|
プライベート エンドポイント接続リソースのプロビジョニング状態。
|
type
|
string
|
リソースの種類。
|
PrivateEndpointIPConfiguration
プライベート エンドポイントの IP 構成。
名前 |
型 |
説明 |
etag
|
string
|
リソースが更新されるたびに変更される一意の読み取り専用文字列。
|
name
|
string
|
リソース グループ内で一意であるリソースの名前。
|
properties.groupId
|
string
|
このプライベート エンドポイントが接続する必要があるリモート リソースから取得したグループの ID。
|
properties.memberName
|
string
|
このプライベート エンドポイントが接続する必要があるリモート リソースから取得したグループのメンバー名。
|
properties.privateIPAddress
|
string
|
プライベート エンドポイントのサブネットから取得したプライベート IP アドレス。
|
type
|
string
|
リソースの種類。
|
PrivateLinkService
プライベート リンク サービス リソース。
名前 |
型 |
説明 |
etag
|
string
|
リソースが更新されるたびに変更される一意の読み取り専用文字列。
|
extendedLocation
|
ExtendedLocation
|
ロード バランサーの拡張された場所。
|
id
|
string
|
リソース ID。
|
location
|
string
|
リソースの場所。
|
name
|
string
|
リソース名。
|
properties.alias
|
string
|
プライベート リンク サービスのエイリアス。
|
properties.autoApproval
|
AutoApproval
|
プライベート リンク サービスの自動承認リスト。
|
properties.destinationIPAddress
|
string
|
プライベート リンク サービスの宛先 IP アドレス。
|
properties.enableProxyProtocol
|
boolean
|
プライベート リンク サービスがプロキシ プロトコルに対して有効かどうか。
|
properties.fqdns
|
string[]
|
Fqdn の一覧。
|
properties.ipConfigurations
|
PrivateLinkServiceIpConfiguration[]
|
プライベート リンク サービスの IP 構成の配列。
|
properties.loadBalancerFrontendIpConfigurations
|
FrontendIPConfiguration[]
|
ロード バランサーの IP 構成への参照の配列。
|
properties.networkInterfaces
|
NetworkInterface[]
|
このプライベート リンク サービス用に作成されたネットワーク インターフェイスへの参照の配列。
|
properties.privateEndpointConnections
|
PrivateEndpointConnection[]
|
プライベート エンドポイントへの接続に関する一覧の配列。
|
properties.provisioningState
|
ProvisioningState
|
プライベート リンク サービス リソースのプロビジョニング状態。
|
properties.visibility
|
Visibility
|
プライベート リンク サービスの可視性リスト。
|
tags
|
object
|
リソース タグ。
|
type
|
string
|
リソースの種類。
|
PrivateLinkServiceConnection
PrivateLinkServiceConnection リソース。
名前 |
型 |
説明 |
etag
|
string
|
リソースが更新されるたびに変更される一意の読み取り専用文字列。
|
id
|
string
|
リソース ID。
|
name
|
string
|
リソース グループ内で一意であるリソースの名前。 この名前は、リソースへのアクセスに使用できます。
|
properties.groupIds
|
string[]
|
このプライベート エンドポイントが接続する必要があるリモート リソースから取得したグループの ID。
|
properties.privateLinkServiceConnectionState
|
PrivateLinkServiceConnectionState
|
リモート リソースへの接続の状態に関する読み取り専用情報のコレクション。
|
properties.privateLinkServiceId
|
string
|
プライベート リンク サービスのリソース ID。
|
properties.provisioningState
|
ProvisioningState
|
プライベート リンク サービス接続リソースのプロビジョニング状態。
|
properties.requestMessage
|
string
|
この接続要求を使用してリモート リソースの所有者に渡されたメッセージ。 140 文字に制限されます。
|
type
|
string
|
リソースの種類。
|
PrivateLinkServiceConnectionState
サービス コンシューマーとプロバイダー間の接続の状態に関する情報のコレクション。
名前 |
型 |
説明 |
actionsRequired
|
string
|
サービス プロバイダーの変更にコンシューマーの更新が必要かどうかを示すメッセージ。
|
description
|
string
|
接続の承認/拒否の理由。
|
status
|
string
|
接続がサービスの所有者によって承認/拒否/削除されたかどうかを示します。
|
PrivateLinkServiceIpConfiguration
プライベート リンク サービスの IP 構成。
名前 |
型 |
説明 |
etag
|
string
|
リソースが更新されるたびに変更される一意の読み取り専用文字列。
|
id
|
string
|
リソース ID。
|
name
|
string
|
プライベート リンク サービスの IP 構成の名前。
|
properties.primary
|
boolean
|
IP 構成がプライマリかどうか。
|
properties.privateIPAddress
|
string
|
IP 構成のプライベート IP アドレス。
|
properties.privateIPAddressVersion
|
IPVersion
|
特定の IP 構成が IPv4 か IPv6 か。 既定値は IPv4 です。
|
properties.privateIPAllocationMethod
|
IPAllocationMethod
|
プライベート IP アドレスの割り当て方法。
|
properties.provisioningState
|
ProvisioningState
|
プライベート リンク サービスの IP 構成リソースのプロビジョニング状態。
|
properties.subnet
|
Subnet
|
サブネット リソースへの参照。
|
type
|
string
|
リソースの種類。
|
Probe
ロード バランサー プローブ。
名前 |
型 |
説明 |
etag
|
string
|
リソースが更新されるたびに変更される一意の読み取り専用文字列。
|
id
|
string
|
リソース ID。
|
name
|
string
|
ロード バランサーによって使用されるプローブのセット内で一意であるリソースの名前。 この名前は、リソースへのアクセスに使用できます。
|
properties.intervalInSeconds
|
integer
|
エンドポイントの正常性状態をプローブする頻度を秒単位で指定します。 通常、この間隔は割り当てられたタイムアウト期間 (秒単位) の半分未満です。これにより、インスタンスをローテーションから外す前に 2 つの完全なプローブが許可されます。 既定値は 15、最小値は 5 です。
|
properties.loadBalancingRules
|
SubResource[]
|
このプローブを使用するロード バランサー規則。
|
properties.noHealthyBackendsBehavior
|
ProbeNoHealthyBackendsBehavior
|
すべてのバックエンド インスタンスがプローブダウンされたときに、ロード バランサーによって新しい接続がどのように処理されるかを決定します。
|
properties.numberOfProbes
|
integer
|
応答がない場合に、エンドポイントへのそれ以上のトラフィックの配信を停止するプローブの数。 この値により、エンドポイントを Azure で使用される一般的な時間よりも速く、または低速にローテーションから外すことができます。
|
properties.port
|
integer
|
プローブを通信するためのポート。 指定できる値の範囲は 1 ~ 65535 です。
|
properties.probeThreshold
|
integer
|
このエンドポイントへのトラフィックの配信を許可または拒否するための連続した成功または失敗したプローブの数。 この値と等しい連続するプローブの数に失敗すると、エンドポイントはローテーションから除外され、同じ数の連続プローブをローテーションに戻す必要があります。
|
properties.protocol
|
ProbeProtocol
|
エンドポイントのプロトコル。 'Tcp' が指定されている場合、プローブを正常に実行するには、受信した ACK が必要です。 'Http' または 'Https' が指定されている場合、プローブを正常に実行するには、指定 URI からの 200 OK 応答が必要です。
|
properties.provisioningState
|
ProvisioningState
|
プローブ リソースのプロビジョニング状態。
|
properties.requestPath
|
string
|
VM から正常性状態を要求するために使用される URI。 プロトコルが http に設定されている場合は、パスが必要です。 それ以外の場合は許可されません。 既定値はありません。
|
type
|
string
|
リソースの種類。
|
ProbeNoHealthyBackendsBehavior
すべてのバックエンド インスタンスがプローブダウンされたときに、ロード バランサーによって新しい接続がどのように処理されるかを決定します。
名前 |
型 |
説明 |
AllProbedDown
|
string
|
新しいフローはバックエンド プールに送信されません。
|
AllProbedUp
|
string
|
すべてのバックエンド インスタンスがプローブダウンされると、受信パケットはすべてのインスタンスに送信されます。
|
ProbeProtocol
エンドポイントのプロトコル。 'Tcp' が指定されている場合、プローブを正常に実行するには、受信した ACK が必要です。 'Http' または 'Https' が指定されている場合、プローブを正常に実行するには、指定 URI からの 200 OK 応答が必要です。
名前 |
型 |
説明 |
Http
|
string
|
|
Https
|
string
|
|
Tcp
|
string
|
|
ProvisioningState
現在のプロビジョニング状態。
名前 |
型 |
説明 |
Deleting
|
string
|
|
Failed
|
string
|
|
Succeeded
|
string
|
|
Updating
|
string
|
|
PublicIPAddress
パブリック IP アドレス リソース。
名前 |
型 |
説明 |
etag
|
string
|
リソースが更新されるたびに変更される一意の読み取り専用文字列。
|
extendedLocation
|
ExtendedLocation
|
パブリック IP アドレスの拡張された場所。
|
id
|
string
|
リソース ID。
|
location
|
string
|
リソースの場所。
|
name
|
string
|
リソース名。
|
properties.ddosSettings
|
DdosSettings
|
パブリック IP アドレスに関連付けられている DDoS 保護カスタム ポリシー。
|
properties.deleteOption
|
DeleteOptions
|
パブリック IP アドレスを使用している VM が削除されたときの動作を指定する
|
properties.dnsSettings
|
PublicIPAddressDnsSettings
|
パブリック IP アドレスに関連付けられている DNS レコードの FQDN。
|
properties.idleTimeoutInMinutes
|
integer
|
パブリック IP アドレスのアイドル タイムアウト。
|
properties.ipAddress
|
string
|
パブリック IP アドレス リソースに関連付けられている IP アドレス。
|
properties.ipConfiguration
|
IPConfiguration
|
パブリック IP アドレスに関連付けられている IP 構成。
|
properties.ipTags
|
IpTag[]
|
パブリック IP アドレスに関連付けられているタグの一覧。
|
properties.linkedPublicIPAddress
|
PublicIPAddress
|
パブリック IP アドレス リソースのリンクされたパブリック IP アドレス。
|
properties.migrationPhase
|
PublicIPAddressMigrationPhase
|
パブリック IP アドレスの移行フェーズ。
|
properties.natGateway
|
NatGateway
|
パブリック IP アドレスの NatGateway。
|
properties.provisioningState
|
ProvisioningState
|
パブリック IP アドレス リソースのプロビジョニング状態。
|
properties.publicIPAddressVersion
|
IPVersion
|
パブリック IP アドレスのバージョン。
|
properties.publicIPAllocationMethod
|
IPAllocationMethod
|
パブリック IP アドレスの割り当て方法。
|
properties.publicIPPrefix
|
SubResource
|
このパブリック IP アドレスの割り当て先となるパブリック IP プレフィックス。
|
properties.resourceGuid
|
string
|
パブリック IP アドレス リソースのリソース GUID プロパティ。
|
properties.servicePublicIPAddress
|
PublicIPAddress
|
パブリック IP アドレス リソースのサービス パブリック IP アドレス。
|
sku
|
PublicIPAddressSku
|
パブリック IP アドレス SKU。
|
tags
|
object
|
リソース タグ。
|
type
|
string
|
リソースの種類。
|
zones
|
string[]
|
リソースに割り当てられた IP を示す可用性ゾーンの一覧が必要です。
|
PublicIPAddressDnsSettings
パブリック IP アドレスに関連付けられている DNS レコードの FQDN が含まれています。
名前 |
型 |
説明 |
domainNameLabel
|
string
|
ドメイン名ラベル。 ドメイン名ラベルと地域化 DNS ゾーンを連結すると、パブリック IP アドレスに関連付けられている完全修飾ドメイン名が構成されます。 ドメイン名ラベルを指定すると、Microsoft Azure DNS システムのパブリック IP に対して DNS レコードが作成されます。
|
domainNameLabelScope
|
PublicIpAddressDnsSettingsDomainNameLabelScope
|
ドメイン名ラベルのスコープ。 ドメイン名ラベルとドメイン名ラベルスコープが指定されている場合、ハッシュ値が FQDN に含まれる Microsoft Azure DNS システムのパブリック IP に対して DNS レコードが作成されます。
|
fqdn
|
string
|
パブリック IP に関連付けられている DNS レコードの完全修飾ドメイン名。 これは、domainNameLabel と地域化された DNS ゾーンの連結です。
|
reverseFqdn
|
string
|
逆引き FQDN。 このパブリック IP アドレスに解決される、ユーザーに表示される完全修飾ドメイン名。 reverseFqdn が指定されている場合は、in-addr.arpa ドメイン内の IP アドレスから逆 FQDN を指す PTR DNS レコードが作成されます。
|
PublicIpAddressDnsSettingsDomainNameLabelScope
ドメイン名ラベルのスコープ。 ドメイン名ラベルとドメイン名ラベルスコープが指定されている場合、ハッシュ値が FQDN に含まれる Microsoft Azure DNS システムのパブリック IP に対して DNS レコードが作成されます。
名前 |
型 |
説明 |
NoReuse
|
string
|
|
ResourceGroupReuse
|
string
|
|
SubscriptionReuse
|
string
|
|
TenantReuse
|
string
|
|
PublicIPAddressMigrationPhase
パブリック IP アドレスの移行フェーズ。
名前 |
型 |
説明 |
Abort
|
string
|
|
Commit
|
string
|
|
Committed
|
string
|
|
None
|
string
|
|
Prepare
|
string
|
|
PublicIPAddressSku
パブリック IP アドレスの SKU。
PublicIPAddressSkuName
パブリック IP アドレス SKU の名前。
名前 |
型 |
説明 |
Basic
|
string
|
|
Standard
|
string
|
|
PublicIPAddressSkuTier
パブリック IP アドレス SKU の層。
名前 |
型 |
説明 |
Global
|
string
|
|
Regional
|
string
|
|
ResourceIdentityType
リソースに使用される ID の種類。 型 'SystemAssigned, UserAssigned' には、暗黙的に作成された ID とユーザー割り当て ID のセットの両方が含まれます。 種類 'None' は、仮想マシンからすべての ID を削除します。
名前 |
型 |
説明 |
None
|
string
|
|
SystemAssigned
|
string
|
|
SystemAssigned, UserAssigned
|
string
|
|
UserAssigned
|
string
|
|
ResourceNavigationLink
ResourceNavigationLink リソース。
名前 |
型 |
説明 |
etag
|
string
|
リソースが更新されるたびに変更される一意の読み取り専用文字列。
|
id
|
string
|
リソース ナビゲーション リンク識別子。
|
name
|
string
|
リソース グループ内で一意であるリソースの名前。 この名前は、リソースへのアクセスに使用できます。
|
properties.link
|
string
|
外部リソースへのリンク。
|
properties.linkedResourceType
|
string
|
リンクされたリソースのリソースの種類。
|
properties.provisioningState
|
ProvisioningState
|
リソース ナビゲーション リンク リソースのプロビジョニング状態。
|
type
|
string
|
リソースの種類。
|
RetentionPolicyParameters
フロー ログの保持ポリシーを定義するパラメーター。
名前 |
型 |
規定値 |
説明 |
days
|
integer
|
0
|
フロー ログ レコードを保持する日数。
|
enabled
|
boolean
|
False
|
保持を有効または無効にするフラグ。
|
Route
リソースをルーティングします。
名前 |
型 |
説明 |
etag
|
string
|
リソースが更新されるたびに変更される一意の読み取り専用文字列。
|
id
|
string
|
リソース ID。
|
name
|
string
|
リソース グループ内で一意であるリソースの名前。 この名前は、リソースへのアクセスに使用できます。
|
properties.addressPrefix
|
string
|
ルートが適用される宛先 CIDR。
|
properties.hasBgpOverride
|
boolean
|
LPM に関係なく、このルートが重複する BGP ルートをオーバーライドするかどうかを示す値。
|
properties.nextHopIpAddress
|
string
|
IP アドレス パケットを転送する必要があります。 次ホップの値は、次ホップの種類が VirtualAppliance であるルートでのみ使用できます。
|
properties.nextHopType
|
RouteNextHopType
|
パケットの送信先となる Azure ホップの種類。
|
properties.provisioningState
|
ProvisioningState
|
ルート リソースのプロビジョニング状態。
|
type
|
string
|
リソースの種類。
|
RouteNextHopType
パケットの送信先となる Azure ホップの種類。
名前 |
型 |
説明 |
Internet
|
string
|
|
None
|
string
|
|
VirtualAppliance
|
string
|
|
VirtualNetworkGateway
|
string
|
|
VnetLocal
|
string
|
|
RouteTable
ルート テーブル リソース。
名前 |
型 |
説明 |
etag
|
string
|
リソースが更新されるたびに変更される一意の読み取り専用文字列。
|
id
|
string
|
リソース ID。
|
location
|
string
|
リソースの場所。
|
name
|
string
|
リソース名。
|
properties.disableBgpRoutePropagation
|
boolean
|
そのルート テーブルで BGP によって学習されたルートを無効にするかどうか。 True は無効を意味します。
|
properties.provisioningState
|
ProvisioningState
|
ルート テーブル リソースのプロビジョニング状態。
|
properties.resourceGuid
|
string
|
ルート テーブルのリソース GUID プロパティ。
|
properties.routes
|
Route[]
|
ルート テーブル内に含まれるルートのコレクション。
|
properties.subnets
|
Subnet[]
|
サブネットへの参照のコレクション。
|
tags
|
object
|
リソース タグ。
|
type
|
string
|
リソースの種類。
|
SecurityRule
ネットワーク セキュリティ規則。
名前 |
型 |
説明 |
etag
|
string
|
リソースが更新されるたびに変更される一意の読み取り専用文字列。
|
id
|
string
|
リソース ID。
|
name
|
string
|
リソース グループ内で一意であるリソースの名前。 この名前は、リソースへのアクセスに使用できます。
|
properties.access
|
SecurityRuleAccess
|
ネットワーク トラフィックは許可または拒否されます。
|
properties.description
|
string
|
このルールの説明。 140 文字に制限されます。
|
properties.destinationAddressPrefix
|
string
|
宛先アドレス プレフィックス。 CIDR または宛先 IP 範囲。 アスタリスク '*' を使用して、すべてのソース IP を照合することもできます。 "VirtualNetwork"、"AzureLoadBalancer"、"Internet" などの既定のタグも使用できます。
|
properties.destinationAddressPrefixes
|
string[]
|
宛先アドレス プレフィックス。 CIDR または宛先 IP 範囲。
|
properties.destinationApplicationSecurityGroups
|
ApplicationSecurityGroup[]
|
宛先として指定されたアプリケーション セキュリティ グループ。
|
properties.destinationPortRange
|
string
|
宛先ポートまたは範囲。 整数または 0 ~ 65535 の範囲。 アスタリスク '*' は、すべてのポートとの照合にも使用できます。
|
properties.destinationPortRanges
|
string[]
|
宛先ポートの範囲。
|
properties.direction
|
SecurityRuleDirection
|
ルールの方向。 方向は、受信トラフィックまたは送信トラフィックでルールを評価するかどうかを指定します。
|
properties.priority
|
integer
|
ルールの優先順位。 値は 100 から 4096 の間で指定できます。 優先順位番号は、コレクション内の各ルールで一意である必要があります。 優先度の数値が小さいと、ルールの優先度が高くなります。
|
properties.protocol
|
SecurityRuleProtocol
|
この規則が適用されるネットワーク プロトコル。
|
properties.provisioningState
|
ProvisioningState
|
セキュリティ 規則リソースのプロビジョニング状態。
|
properties.sourceAddressPrefix
|
string
|
CIDR またはソース IP 範囲。 アスタリスク '*' を使用して、すべてのソース IP を照合することもできます。 "VirtualNetwork"、"AzureLoadBalancer"、"Internet" などの既定のタグも使用できます。 これがイングレス ルールの場合は、ネットワーク トラフィックの発信元を指定します。
|
properties.sourceAddressPrefixes
|
string[]
|
CIDR またはソース IP 範囲。
|
properties.sourceApplicationSecurityGroups
|
ApplicationSecurityGroup[]
|
ソースとして指定されたアプリケーション セキュリティ グループ。
|
properties.sourcePortRange
|
string
|
ソース ポートまたは範囲。 整数または 0 ~ 65535 の範囲。 アスタリスク '*' は、すべてのポートとの照合にも使用できます。
|
properties.sourcePortRanges
|
string[]
|
ソース ポートの範囲。
|
type
|
string
|
リソースの種類。
|
SecurityRuleAccess
ネットワーク トラフィックが許可されているか拒否されているか。
名前 |
型 |
説明 |
Allow
|
string
|
|
Deny
|
string
|
|
SecurityRuleDirection
ルールの方向。 方向は、受信トラフィックまたは送信トラフィックでルールを評価するかどうかを指定します。
名前 |
型 |
説明 |
Inbound
|
string
|
|
Outbound
|
string
|
|
SecurityRuleProtocol
この規則が適用されるネットワーク プロトコル。
名前 |
型 |
説明 |
*
|
string
|
|
Ah
|
string
|
|
Esp
|
string
|
|
Icmp
|
string
|
|
Tcp
|
string
|
|
Udp
|
string
|
|
ServiceAssociationLink
ServiceAssociationLink リソース。
名前 |
型 |
説明 |
etag
|
string
|
リソースが更新されるたびに変更される一意の読み取り専用文字列。
|
id
|
string
|
リソース ID。
|
name
|
string
|
リソース グループ内で一意であるリソースの名前。 この名前は、リソースへのアクセスに使用できます。
|
properties.allowDelete
|
boolean
|
true の場合、リソースを削除できます。
|
properties.link
|
string
|
外部リソースへのリンク。
|
properties.linkedResourceType
|
string
|
リンクされたリソースのリソースの種類。
|
properties.locations
|
string[]
|
場所の一覧。
|
properties.provisioningState
|
ProvisioningState
|
サービス関連付けリンク リソースのプロビジョニング状態。
|
type
|
string
|
リソースの種類。
|
ServiceEndpointPolicy
サービス エンドポイント ポリシー リソース。
名前 |
型 |
説明 |
etag
|
string
|
リソースが更新されるたびに変更される一意の読み取り専用文字列。
|
id
|
string
|
リソース ID。
|
kind
|
string
|
サービス エンドポイント ポリシーの種類。 これは、Azure portal エクスペリエンスに使用されるメタデータです。
|
location
|
string
|
リソースの場所。
|
name
|
string
|
リソース名。
|
properties.contextualServiceEndpointPolicies
|
string[]
|
コンテキスト サービス エンドポイント ポリシーのコレクション。
|
properties.provisioningState
|
ProvisioningState
|
サービス エンドポイント ポリシー リソースのプロビジョニング状態。
|
properties.resourceGuid
|
string
|
サービス エンドポイント ポリシー リソースのリソース GUID プロパティ。
|
properties.serviceAlias
|
string
|
ポリシーがサービスに属しているかどうかを示すエイリアス
|
properties.serviceEndpointPolicyDefinitions
|
ServiceEndpointPolicyDefinition[]
|
サービス エンドポイント ポリシーのサービス エンドポイント ポリシー定義のコレクション。
|
properties.subnets
|
Subnet[]
|
サブネットへの参照のコレクション。
|
tags
|
object
|
リソース タグ。
|
type
|
string
|
リソースの種類。
|
ServiceEndpointPolicyDefinition
サービス エンドポイント ポリシー定義。
名前 |
型 |
説明 |
etag
|
string
|
リソースが更新されるたびに変更される一意の読み取り専用文字列。
|
id
|
string
|
リソース ID。
|
name
|
string
|
リソース グループ内で一意であるリソースの名前。 この名前は、リソースへのアクセスに使用できます。
|
properties.description
|
string
|
このルールの説明。 140 文字に制限されます。
|
properties.provisioningState
|
ProvisioningState
|
サービス エンドポイント ポリシー定義リソースのプロビジョニング状態。
|
properties.service
|
string
|
サービス エンドポイント名。
|
properties.serviceResources
|
string[]
|
サービス リソースの一覧。
|
type
|
string
|
リソースの種類。
|
サービス エンドポイントのプロパティ。
名前 |
型 |
説明 |
locations
|
string[]
|
場所の一覧。
|
networkIdentifier
|
SubResource
|
ネットワーク識別子としての SubResource。
|
provisioningState
|
ProvisioningState
|
サービス エンドポイント リソースのプロビジョニング状態。
|
service
|
string
|
エンドポイント サービスの種類。
|
SharingScope
AAD テナント内の他のサブスクリプションとサブネットを共有できるようにするには、このプロパティを Tenant に設定します。 このプロパティは、defaultOutboundAccess が false に設定されている場合にのみ設定できます。両方のプロパティは、サブネットが空の場合にのみ設定できます。
名前 |
型 |
説明 |
DelegatedServices
|
string
|
|
Tenant
|
string
|
|
Subnet
仮想ネットワーク リソース内のサブネット。
名前 |
型 |
規定値 |
説明 |
etag
|
string
|
|
リソースが更新されるたびに変更される一意の読み取り専用文字列。
|
id
|
string
|
|
リソース ID。
|
name
|
string
|
|
リソース グループ内で一意であるリソースの名前。 この名前は、リソースへのアクセスに使用できます。
|
properties.addressPrefix
|
string
|
|
サブネットのアドレス プレフィックス。
|
properties.addressPrefixes
|
string[]
|
|
サブネットのアドレス プレフィックスの一覧。
|
properties.applicationGatewayIPConfigurations
|
ApplicationGatewayIPConfiguration[]
|
|
仮想ネットワーク リソースのアプリケーション ゲートウェイ IP 構成。
|
properties.defaultOutboundAccess
|
boolean
|
|
サブネット内のすべての VM の既定の送信接続を無効にするには、このプロパティを false に設定します。 このプロパティは、サブネットの作成時にのみ設定でき、既存のサブネットに対して更新することはできません。
|
properties.delegations
|
Delegation[]
|
|
サブネット上の委任への参照の配列。
|
properties.ipAllocations
|
SubResource[]
|
|
このサブネットを参照する IpAllocation の配列。
|
properties.ipConfigurationProfiles
|
IPConfigurationProfile[]
|
|
このサブネットを参照する IP 構成プロファイルの配列。
|
properties.ipConfigurations
|
IPConfiguration[]
|
|
サブネットを使用したネットワーク インターフェイス IP 構成への参照の配列。
|
properties.ipamPoolPrefixAllocations
|
IpamPoolPrefixAllocation[]
|
|
IP アドレス プレフィックスを割り当てる IPAM プールの一覧。
|
properties.natGateway
|
SubResource
|
|
このサブネットに関連付けられている Nat ゲートウェイ。
|
properties.networkSecurityGroup
|
NetworkSecurityGroup
|
|
NetworkSecurityGroup リソースへの参照。
|
properties.privateEndpointNetworkPolicies
|
VirtualNetworkPrivateEndpointNetworkPolicies
|
Disabled
|
サブネット内のプライベート エンドポイントでネットワーク ポリシーの適用を有効または無効にします。
|
properties.privateEndpoints
|
PrivateEndpoint[]
|
|
プライベート エンドポイントへの参照の配列。
|
properties.privateLinkServiceNetworkPolicies
|
VirtualNetworkPrivateLinkServiceNetworkPolicies
|
Enabled
|
サブネット内のプライベート リンク サービスに対するネットワーク ポリシーの適用を有効または無効にします。
|
properties.provisioningState
|
ProvisioningState
|
|
サブネット リソースのプロビジョニング状態。
|
properties.purpose
|
string
|
|
委任やその他のユーザー定義プロパティに基づいて、このサブネットの使用意図を識別する読み取り専用文字列。
|
properties.resourceNavigationLinks
|
ResourceNavigationLink[]
|
|
サブネットを使用する外部リソースへの参照の配列。
|
properties.routeTable
|
RouteTable
|
|
RouteTable リソースへの参照。
|
properties.serviceAssociationLinks
|
ServiceAssociationLink[]
|
|
このサブネットに挿入されるサービスへの参照の配列。
|
properties.serviceEndpointPolicies
|
ServiceEndpointPolicy[]
|
|
サービス エンドポイント ポリシーの配列。
|
properties.serviceEndpoints
|
ServiceEndpointPropertiesFormat[]
|
|
サービス エンドポイントの配列。
|
properties.sharingScope
|
SharingScope
|
|
AAD テナント内の他のサブスクリプションとサブネットを共有できるようにするには、このプロパティを Tenant に設定します。 このプロパティは、defaultOutboundAccess が false に設定されている場合にのみ設定できます。両方のプロパティは、サブネットが空の場合にのみ設定できます。
|
type
|
string
|
|
リソースの種類。
|
SubResource
別のサブリソースへの参照。
名前 |
型 |
説明 |
id
|
string
|
リソース ID。
|
SyncMode
バックエンド プールのバックエンド アドレス同期モード
名前 |
型 |
説明 |
Automatic
|
string
|
|
Manual
|
string
|
|
TrafficAnalyticsConfigurationProperties
トラフィック分析の構成を定義するパラメーター。
名前 |
型 |
説明 |
enabled
|
boolean
|
トラフィック分析を有効または無効にするフラグ。
|
trafficAnalyticsInterval
|
integer
|
TA サービスがフロー分析を実行する頻度を決定する間隔 (分)。
|
workspaceId
|
string
|
アタッチされたワークスペースのリソース GUID。
|
workspaceRegion
|
string
|
アタッチされたワークスペースの場所。
|
workspaceResourceId
|
string
|
アタッチされたワークスペースのリソース ID。
|
TrafficAnalyticsProperties
トラフィック分析の構成を定義するパラメーター。
TransportProtocol
エンドポイントのトランスポート プロトコル。
名前 |
型 |
説明 |
All
|
string
|
|
Tcp
|
string
|
|
Udp
|
string
|
|
UserAssignedIdentities
リソースに関連付けられているユーザー ID の一覧。 ユーザー ID ディクショナリ のキー参照は、'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}' という形式の ARM リソース ID になります。
VirtualNetworkPrivateEndpointNetworkPolicies
サブネット内のプライベート エンドポイントでネットワーク ポリシーの適用を有効または無効にします。
名前 |
型 |
説明 |
Disabled
|
string
|
|
Enabled
|
string
|
|
NetworkSecurityGroupEnabled
|
string
|
|
RouteTableEnabled
|
string
|
|
VirtualNetworkPrivateLinkServiceNetworkPolicies
サブネット内のプライベート リンク サービスに対するネットワーク ポリシーの適用を有効または無効にします。
名前 |
型 |
説明 |
Disabled
|
string
|
|
Enabled
|
string
|
|
VirtualNetworkTap
Virtual Network Tap リソース。
名前 |
型 |
説明 |
etag
|
string
|
リソースが更新されるたびに変更される一意の読み取り専用文字列。
|
id
|
string
|
リソース ID。
|
location
|
string
|
リソースの場所。
|
name
|
string
|
リソース名。
|
properties.destinationLoadBalancerFrontEndIPConfiguration
|
FrontendIPConfiguration
|
タップを受信する内部ロード バランサー上のプライベート IP アドレスへの参照。
|
properties.destinationNetworkInterfaceIPConfiguration
|
NetworkInterfaceIPConfiguration
|
タップを受信するコレクター NIC のプライベート IP アドレスへの参照。
|
properties.destinationPort
|
integer
|
タップされたトラフィックを受信する VXLAN 宛先ポート。
|
properties.networkInterfaceTapConfigurations
|
NetworkInterfaceTapConfiguration[]
|
タップする必要があるネットワーク インターフェイス IP 構成のリソース ID の一覧を指定します。
|
properties.provisioningState
|
ProvisioningState
|
仮想ネットワーク タップ リソースのプロビジョニング状態。
|
properties.resourceGuid
|
string
|
仮想ネットワーク タップ リソースのリソース GUID プロパティ。
|
tags
|
object
|
リソース タグ。
|
type
|
string
|
リソースの種類。
|
Visibility
プライベート リンク サービスの可視性リスト。
名前 |
型 |
説明 |
subscriptions
|
string[]
|
サブスクリプションの一覧。
|