集装箱应用程序或集装箱应用程序环境臂模板

发布于 2025-02-10 05:28:40 字数 3879 浏览 3 评论 0原文

我正在尝试使用ARM模板创建一个容器应用程序。 容器应用程序在VNET之内,入口连接也仅限于VNET。 我从门户网站下载了自动化的模板,并且在模板中具有此模板


{
    "name": "[parameters('environmentName')]",
    "location": "[parameters('location')]",
    "dependsOn": [
        "[concat('Microsoft.OperationalInsights/workspaces/', parameters('workspaceName'))]",
        "Microsoft.Resources/deployments/newInfrastructureSubnetTemplate"
    ],
    "properties": {
        "internalLoadBalancerEnabled": false,
        "appLogsConfiguration": {
            "destination": "log-analytics",
            "logAnalyticsConfiguration": {
                "customerId": "[reference(concat('Microsoft.OperationalInsights/workspaces/', parameters('workspaceName')), '2020-08-01').customerId]",
                "sharedKey": "[listKeys(concat('Microsoft.OperationalInsights/workspaces/', parameters('workspaceName')), '2020-08-01').primarySharedKey]"
            }
        },
        "vnetConfiguration": {
            "infrastructureSubnetId": "/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.Network/virtualNetworks/containerapps-vnet/subnets/containerapps-subnet-0",
            "internal": true
        },
        "zoneRedundant": false
    },
    "apiVersion": "2022-03-01",
    "type": "Microsoft.App/managedEnvironments"
}

,但由于托管群集导致故障而失败。

New-AzResourceGroupDeployment : 3:11:14 PM - The deployment 'template' failed with error(s). Showing 1 out of 1 error(s).
Status Message: Managed environment failed to initialize due to managed clusters failed. (Code:OperationFailed)
CorrelationId: <correlation-id>
At line:1 char:1
+ New-AzResourceGroupDeployment -ResourceGroupName dhapi-ml -TemplateFi ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [New-AzResourceGroupDeployment], Exception
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet

VNET,子网和日志分析工作空间也是使用与下面相同的模板创建的。


{
    "apiVersion": "2020-08-01",
    "name": "[parameters('workspaceName')]",
    "type": "Microsoft.OperationalInsights/workspaces",
    "location": "[parameters('workspaceLocation')]",
    "dependsOn": [],
    "properties": {
        "sku": {
            "name": "PerGB2018"
        },
        "retentionInDays": 30,
        "workspaceCapping": {}
    }
},
{
    "type": "Microsoft.Resources/deployments",
    "apiVersion": "2020-06-01",
    "name": "newInfrastructureSubnetTemplate",
    "resourceGroup": "<resource-group-name>",
    "subscriptionId": "<subscription-id>",
    "properties": {
        "mode": "Incremental",
        "template": {
            "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
            "contentVersion": "1.0.0.0",
            "parameters": {},
            "variables": {},
            "resources": [
                {
                    "type": "Microsoft.Network/virtualNetworks/subnets",
                    "apiVersion": "2020-07-01",
                    "name": "containerapps-vnet/containerapps-subnet-0",
                    "properties": {
                        "delegations": [],
                        "serviceEndpoints": [],
                        "addressPrefix": "10.0.0.0/23"
                    }
                }
            ]
        }
    },
    "dependsOn": [
        "[resourceId('Microsoft.Network/virtualNetworks', 'containerapps-vnet')]"
    ]
},
{
    "type": "Microsoft.Network/virtualNetworks",
    "apiVersion": "2020-07-01",
    "location": "eastus",
    "name": "containerapps-vnet",
    "properties": {
        "addressSpace": {
            "addressPrefixes": [
                "10.0.0.0/16"
            ]
        },
        "subnets": []
    }
}

I am trying to create a container app using ARM template.
The container app is within a VNet and ingress connection is also limited to VNet.
I downloaded the template for automation from portal and it has this in template


{
    "name": "[parameters('environmentName')]",
    "location": "[parameters('location')]",
    "dependsOn": [
        "[concat('Microsoft.OperationalInsights/workspaces/', parameters('workspaceName'))]",
        "Microsoft.Resources/deployments/newInfrastructureSubnetTemplate"
    ],
    "properties": {
        "internalLoadBalancerEnabled": false,
        "appLogsConfiguration": {
            "destination": "log-analytics",
            "logAnalyticsConfiguration": {
                "customerId": "[reference(concat('Microsoft.OperationalInsights/workspaces/', parameters('workspaceName')), '2020-08-01').customerId]",
                "sharedKey": "[listKeys(concat('Microsoft.OperationalInsights/workspaces/', parameters('workspaceName')), '2020-08-01').primarySharedKey]"
            }
        },
        "vnetConfiguration": {
            "infrastructureSubnetId": "/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.Network/virtualNetworks/containerapps-vnet/subnets/containerapps-subnet-0",
            "internal": true
        },
        "zoneRedundant": false
    },
    "apiVersion": "2022-03-01",
    "type": "Microsoft.App/managedEnvironments"
}

But this fails with an error because of failure due to managed cluster.

New-AzResourceGroupDeployment : 3:11:14 PM - The deployment 'template' failed with error(s). Showing 1 out of 1 error(s).
Status Message: Managed environment failed to initialize due to managed clusters failed. (Code:OperationFailed)
CorrelationId: <correlation-id>
At line:1 char:1
+ New-AzResourceGroupDeployment -ResourceGroupName dhapi-ml -TemplateFi ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [New-AzResourceGroupDeployment], Exception
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet

VNet, subnet and log-analytics workspace are also created using the same template as below for your reference.


{
    "apiVersion": "2020-08-01",
    "name": "[parameters('workspaceName')]",
    "type": "Microsoft.OperationalInsights/workspaces",
    "location": "[parameters('workspaceLocation')]",
    "dependsOn": [],
    "properties": {
        "sku": {
            "name": "PerGB2018"
        },
        "retentionInDays": 30,
        "workspaceCapping": {}
    }
},
{
    "type": "Microsoft.Resources/deployments",
    "apiVersion": "2020-06-01",
    "name": "newInfrastructureSubnetTemplate",
    "resourceGroup": "<resource-group-name>",
    "subscriptionId": "<subscription-id>",
    "properties": {
        "mode": "Incremental",
        "template": {
            "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
            "contentVersion": "1.0.0.0",
            "parameters": {},
            "variables": {},
            "resources": [
                {
                    "type": "Microsoft.Network/virtualNetworks/subnets",
                    "apiVersion": "2020-07-01",
                    "name": "containerapps-vnet/containerapps-subnet-0",
                    "properties": {
                        "delegations": [],
                        "serviceEndpoints": [],
                        "addressPrefix": "10.0.0.0/23"
                    }
                }
            ]
        }
    },
    "dependsOn": [
        "[resourceId('Microsoft.Network/virtualNetworks', 'containerapps-vnet')]"
    ]
},
{
    "type": "Microsoft.Network/virtualNetworks",
    "apiVersion": "2020-07-01",
    "location": "eastus",
    "name": "containerapps-vnet",
    "properties": {
        "addressSpace": {
            "addressPrefixes": [
                "10.0.0.0/16"
            ]
        },
        "subnets": []
    }
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

二智少女 2025-02-17 05:28:40

订阅未注册服务。我有什么办法
可以用臂模板进行注册。 (不是通过Azure Portal或CLI)。

谢谢 @ shui shengbao ,如上所述 这里答案,以便对其他成员在类似问题上是有益的。

似乎没有这样的方式通过 注册资源提供商
手臂模板。如果资源 ,您可以使用手动注册
提供商未在您的订阅中注册。

另外,我们可以使用PowerShell使用以下命令(例如)(例如)注册资源提供商: -

Register-AzResourceProvider -ProviderNamespace Microsoft.ContainerService

如我们的订阅中已注册的,它可能向您显示 注册 ,但是您可以进行部署资源的操作。

有关更多信息,请参阅此 Microsoft文档 | 注册资源提供商

The subscription is not registered for service. Is there any way I
can register it with ARM template. (Not through Azure Portal or CLI) .

Thank you @Shui shengbao As mentioned here, and after my research posting the same as an answer so that it will be beneficial for other members for similar issue.

It seems , There is no such way to register resource provider through
ARM Template. You can use the manual registration ,if the resource
provider is not registered in your subscription.

Alternatively, we can use the PowerShell to register resource provider by using below command (e.g):-

Register-AzResourceProvider -ProviderNamespace Microsoft.ContainerService

As its already registered in our subscription ,it might be showing you registering but you can do operations to deploy resources.

enter image description here

For more information please refer this MICROSOFT DOCUMENTATION| Register resource provider .

最佳男配角 2025-02-17 05:28:40

订阅未注册以使用Microsoft.ContainerService
我只是从门户网站注册了它,或者您可以使用PowerShell/AZCLI进行此操作。
然后它可以创建容器应用程序。

The subscription was not registered to use Microsoft.ContainerService
I just registered it from portal or you can use powershell/azcli to do it.
And then it worked to create the container app.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文