我尝试使用powershell和命令new-AzResources在应用程序网关中创建一些对象,如探针、规则等。我使用以下代码片段:
### Get properties
$get = Get-AzResource -ResourceType Microsoft.Network/applicationGateways -Name appgw -ResourceGroupName rgappgw
$user.Properties.probes.Properties
$properties = @{
protocol = 'Http';
path = '/';
interval = '30';
timeout = '30';
unhealthyThreshold = '3';
pickHostNameFromBackendHttpSettings = $true;
minServers = '0';
match = '200-399';
}
$SlotParams = @{
ResourceName = "appGwName"
Location = "West Europe"
ResourceGroupName = "AppGwRg"
ResourceType = "Microsoft.Network/applicationGateways/probes/probename" ####name of probes
PropertyObject = $properties
}
$execution = New-AzResource @SlotParams -Force
但我得到以下错误:
New-AzResource:
Line |
23 | $getSlotApse = New-AzResource @SlotParams -Force
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| {
"Message": "No HTTP resource was found that matches the request URI 'https://westeurope.network.azure.com:30058/123-124-14-4444-4444444/444444444444/subscriptions/mysubs/resourceGroups/AppGwRg/providers/Microsoft.Network/applicationGateways/appGwName/probes/probename?api-version=2022-07-01'."
}
CorrelationId: 12939812312831983
我用同样的逻辑来创建应用服务,但是我不明白我在应用网关上做错了什么。你能给予我一个建议吗?
谢谢
1条答案
按热度按时间c0vxltue1#
我在我的环境中进行了复制,并从Microsoft-Document中获取了以下命令:
您提供的命令或脚本出现错误,因此,我已使用以下脚本创建应用程序网关。
首先,我使用以下命令创建了Subnet,然后创建了Vnet和所有其他所需资源:
输出:
在powershell中运行上述命令后,将在Portal中创建资源