相关文章推荐
俊秀的熊猫  ·  mysql ...·  2 月前    · 
健壮的鸵鸟  ·  java ...·  10 月前    · 

Azure 容器应用资源已从 Microsoft.Web 命名空间迁移到 Microsoft.App 命名空间。 有关详细信息,请参阅 2022 年 3 月从 Microsoft.Web 到 Microsoft.App 的命名空间迁移

容器应用环境

下表描述了容器应用环境资源中可用的属性。

ARM 模板的容器应用资源具有以下属性:

"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "location": { "defaultValue": "canadacentral", "type": "String" "dapr_ai_instrumentation_key": { "defaultValue": "", "type": "String" "environment_name": { "defaultValue": "myenvironment", "type": "String" "log_analytics_customer_id": { "type": "String" "log_analytics_shared_key": { "type": "SecureString" "storage_account_name": { "type": "String" "storage_account_key": { "type": "SecureString" "storage_share_name": { "type": "String" "variables": {}, "resources": [ "type": "Microsoft.App/managedEnvironments", "apiVersion": "2022-03-01", "name": "[parameters('environment_name')]", "location": "[parameters('location')]", "properties": { "daprAIInstrumentationKey": "[parameters('dapr_ai_instrumentation_key')]", "appLogsConfiguration": { "destination": "log-analytics", "logAnalyticsConfiguration": { "customerId": "[parameters('log_analytics_customer_id')]", "sharedKey": "[parameters('log_analytics_shared_key')]" "resources": [ "type": "storages", "name": "myazurefiles", "apiVersion": "2022-03-01", "dependsOn": [ "[resourceId('Microsoft.App/managedEnvironments', parameters('environment_name'))]" "properties": { "azureFile": { "accountName": "[parameters('storage_account_name')]", "accountKey": "[parameters('storage_account_key')]", "shareName": "[parameters('storage_share_name')]", "accessMode": "ReadWrite"

下表描述了容器应用资源中可用的属性。

ARM 模板的容器应用资源具有以下属性:

environmentId 值采用以下形式:

/subscriptions/<SUBSCRIPTION_ID>/resourcegroups/<RESOURCE_GROUP_NAME>/providers/Microsoft.App/environmentId/<ENVIRONMENT_NAME>

在本示例中,输入你的值,代替由 <> 括号括起来的占位符标记。

properties.configuration

资源的 properties.configuration 对象具有以下属性:

以下示例 ARM 模板将部署容器应用。

"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "containerappName": { "defaultValue": "mycontainerapp", "type": "String" "location": { "defaultValue": "canadacentral", "type": "String" "environment_name": { "defaultValue": "myenvironment", "type": "String" "container_image": { "type": "String" "registry_password": { "type": "SecureString" "variables": {}, "resources": [ "apiVersion": "2022-03-01", "type": "Microsoft.App/containerApps", "name": "[parameters('containerappName')]", "location": "[parameters('location')]", "identity": { "type": "None" "properties": { "managedEnvironmentId": "[resourceId('Microsoft.App/managedEnvironments', parameters('environment_name'))]", "configuration": { "secrets": [ "name": "mysecret", "value": "thisismysecret" "name": "myregistrypassword", "value": "[parameters('registry_password')]" "ingress": { "external": true, "targetPort": 80, "allowInsecure": false, "traffic": [ "latestRevision": true, "weight": 100 "registries": [ "server": "myregistry.azurecr.io", "username": "[parameters('containerappName')]", "passwordSecretRef": "myregistrypassword" "dapr": { "appId": "[parameters('containerappName')]", "appPort": 80, "appProtocol": "http", "enabled": true "template": { "revisionSuffix": "myrevision", "containers": [ "name": "main", "image": "[parameters('container_image')]", "env": [ "name": "HTTP_PORT", "value": "80" "name": "SECRET_VAL", "secretRef": "mysecret" "resources": { "cpu": 0.5, "memory": "1Gi" "probes": [ "type": "liveness", "httpGet": { "path": "/health", "port": 8080, "httpHeaders": [ "name": "Custom-Header", "value": "liveness probe" "initialDelaySeconds": 7, "periodSeconds": 3 "type": "readiness", "tcpSocket": { "port": 8081 "initialDelaySeconds": 10, "periodSeconds": 3 "type": "startup", "httpGet": { "path": "/startup", "port": 8080, "httpHeaders": [ "name": "Custom-Header", "value": "startup probe" "initialDelaySeconds": 3, "periodSeconds": 3 "volumeMounts": [ "mountPath": "/myempty", "volumeName": "myempty" "mountPath": "/myfiles", "volumeName": "azure-files-volume" "scale": { "minReplicas": 1, "maxReplicas": 3 "volumes": [ "name": "myempty", "storageType": "EmptyDir" "name": "azure-files-volume", "storageType": "AzureFile", "storageName": "myazurefiles" tagname: value properties: managedEnvironmentId: /subscriptions/mysubscription/resourceGroups/myresourcegroup/providers/Microsoft.App/managedEnvironments/myenvironment configuration: activeRevisionsMode: Multiple secrets: - name: mysecret value: thisismysecret - name: myregistrypassword value: I<3containerapps ingress: external: true allowInsecure: false targetPort: 80 traffic: - latestRevision: true weight: 100 transport: Auto registries: - passwordSecretRef: myregistrypassword server: myregistry.azurecr.io username: myregistrye dapr: appId: mycontainerapp appPort: 80 appProtocol: http enabled: true template: revisionSuffix: myrevision containers: - image: nginx name: nginx - name: HTTP_PORT value: 80 - name: secret_name secretRef: mysecret resources: cpu: 0.5 memory: 1Gi probes: - type: liveness httpGet: path: "/health" port: 8080 httpHeaders: - name: "Custom-Header" value: "liveness probe" initialDelaySeconds: 7 periodSeconds: 3 - type: readiness tcpSocket: port: 8081 initialDelaySeconds: 10 periodSeconds: 3 - type: startup httpGet: path: "/startup" port: 8080 httpHeaders: - name: "Custom-Header" value: "startup probe" initialDelaySeconds: 3 periodSeconds: 3 scale: minReplicas: 1 maxReplicas: 3