简体   繁体   English

“TypeError: _internal_init() got multiple values for argument”创建时出错 Azure App Insights with Pulumi

[英]" TypeError: _internal_init() got multiple values for argument" error when created Azure App Insights with Pulumi

I wanna create Azure Application Insights with Python with this reference .我想使用此参考创建 Azure Application Insights 和 Python。

And also this reference is about the update of SDK.还有这个参考是关于 SDK 的更新。

I imported a special version with:我导入了一个特殊版本:

from pulumi_azure_native.insights import v20200202preview as insights

My code is:我的代码是:

app_insights = insights.Component('app_insights',
                                      args=insights.ComponentArgs(
                                          application_type='web',
                                          kind='web',
                                          flow_type='Bluefield',
                                          ingestion_mode='LogAnalytics',
                                          resource_group_name=resource_group.name,
                                          location=location_name,
                                          resource_name=get_resource_name(
                                              'app-insight'),
                                          tags=tags_group,
                                          workspace_resource_id='/subscriptions/****-***-**-ae8b-****/resourcegroups/rg-dev-gx/providers/microsoft.operationalinsights/workspaces/insight-wkspc-gx',
    
                                      ),
                                      )

with this code I received the error:使用此代码我收到错误:

__self__._internal_init(resource_name, opts, **resource_args.__dict__)
TypeError: _internal_init() got multiple values for argument 'resource_name'
error: an unhandled error occurred: Program exited with non-zero exit code: 1

Here is what you need, give a try using the classic library Azure Classic for Pulumi.这是您需要的,尝试使用 Pulumi 的经典库Azure Classic

import pulumi
import pulumi_azure as azure


my_resource_group = azure.core.ResourceGroup("my_resource_group", location="West Europe")
my_analytics_workspace = azure.operationalinsights.AnalyticsWorkspace("my_analytics_workspace",
                                                                           location=my_resource_group.location,
                                                                           resource_group_name=my_resource_group.name,
                                                                           sku="PerGB2018",
                                                                           retention_in_days=30)
my_insights = azure.appinsights.Insights("my_insights",
                                              location=my_resource_group.location,
                                              resource_group_name=my_resource_group.name,
                                              workspace_id=my_analytics_workspace.id,
                                              application_type="web")
pulumi.export("instrumentationKey", my_insights.instrumentation_key)
pulumi.export("appId", my_insights.app_id)

This is for python but in the link below you can also see for TypeScript for example.这是针对 python 的,但在下面的链接中,您还可以看到例如 TypeScript。 https://www.pulumi.com/registry/packages/azure/api-docs/appinsights/insights/ https://www.pulumi.com/registry/packages/azure/api-docs/appinsights/insights/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 df to table 抛出错误 TypeError: __init__() got multiple values for argument 'schema' - df to table throw error TypeError: __init__() got multiple values for argument 'schema' 在使用 pandas 在 python 中执行 SQL 查询时,我遇到了错误:TypeError: __init__() got multiple values for argument 'schema' - While performing SQL query in python using pandas i am facing the error : TypeError: __init__() got multiple values for argument 'schema' 如何申请一个Pulumi Azure Function App runtime - How to apply a Pulumi Azure Function App runtime 无法访问 Pulumi 创建的 Azure 存储表 - 禁止访问 (403) - Unable to access a Pulumi Created Azure Storage Table - Access Forbidden (403) 当我使用 Pulumi 在 Cosmos DB 中创建容器时,我收到此错误“'resource.partitionKey.paths' 应该是 'array' 类型但得到一个字符串” - When I create containers in Cosmos DB with the Pulumi I received this error "'resource.partitionKey.paths' should be of type 'array' but got a string" Azure REST Api 500 在 virtual.network 中创建应用服务槽时出现内部服务器错误 - Azure REST Api 500 Internal Server Error when creating a app service slot in a virtual network App Insights cookies 被 Azure 防火墙阻止 - App Insights cookies are blocked by Azure Firewall ILogger 在本地记录应用洞察,但不在 azure - ILogger logs to app insights locally but not on azure Pulumi:如何从 Azure 中的 Function 应用程序中检索 function 名称? - Pulumi: How can I retrieve function names from a Function App in Azure? 无法使用 firebase 创建的登录模块进行注册,并收到错误“类型错误:无法从客户端读取 null 的属性‘电子邮件’” - Cannot signUp with login module created with firebase and got the error 'TypeError: Cannot read property 'email' of null' from the client sidee
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM