小编gra*_*a36的帖子

应用程序洞察:分析 - 如何在特定位置提取字符串

我想做,

  • 在"2."中提取"查询"字符串,其中param = 1,如下所示
  • 使用表格为"3"获取Google Analytics中的网页视图

1. pageView中包含的实际网址

  • https://example.com/dir01/?query=apple&param=1
  • https://example.com/dir01/?query=apple&param=1
  • https://example.com/dir01/?query=lemon+juice&param=1
  • https://example.com/dir01/?query=lemon+juice&param=0
  • https://example.com/dir01/?query=tasteful+grape+wine&param=1

2.预期提取的价值

  • apple
  • lemon+juice
  • tasteful+grape+wine

3. AI Analytics的预期输出

  • 查询参数| 计数
    • 苹果| 2
    • 柠檬+果汁| 1
    • 雅致+葡萄+葡萄酒| 1

图片

试图这样做

https://docs.microsoft.com/en-us/azure/application-insights/app-insights-analytics-reference#parseurl

https://aka.ms/AIAnalyticsDemo

我认为extractparseurl(url)应该是有用的.我尝试了后者,parseurl(url)但不知道如何将"查询参数"提取为一列.

pageViews
| where timestamp > ago(1d)
| extend parsed_url=parseurl(url)
| summarize count() by tostring(parsed_url)
| render barchart 
Run Code Online (Sandbox Code Playgroud)
  • url
    • http://aiconnect2.cloudapp.net/FabrikamProd/
  • parsed_url
    • {"Scheme":"http","Host":"aiconnect2.cloudapp.net","Port":"","Path":"/FabrikamProd/","Username":"","Password":"","Query Parameters":{},"Fragment":""}

azure azure-application-insights ms-app-analytics kusto

8
推荐指数
1
解决办法
7126
查看次数

Runbook中的Get-AzureRmAppServicePlan和Get-AzureRmWebApp返回异常

我想使用Get-AzureRm*Automation Runbook中的命令获取所有属性,但是以下内容返回异常。如何编写代码以正确运行这些命令?

  • 返回异常
    • Get-AzureRmAppServicePlan
    • Get-AzureRmWebApp
  • 返回预期结果
    • Get-AzureRmStorageAccount

输入-Powershell Runbook(不是工作流程)

Write-Output $PSVersionTable
$resourceGroupName = "(snipped)"
$appServicePlans = Get-AzureRmAppServicePlan -ResourceGroupName $resourceGroupName

$Cred = Get-AutomationPSCredential -Name "pscred" # works as expected
Add-AzureRmAccount -Credential $Cred
Add-AzureAccount -Credential $Cred

$appServicePlans = `
    Get-AzureRmAppServicePlan -ResourceGroupName $resourceGroupName
$appServices = `
    Get-AzureRmWebApp -ResourceGroupName $resourceGroupName
$storageAccounts = `
    Get-AzureRmStorageAccount -ResourceGroupName $resourceGroupName
Run Code Online (Sandbox Code Playgroud)

输出

通过管理门户中的[测试]

Name                           Value
----                           -----
PSVersion                      5.0.10514.2
WSManStackVersion              3.0
SerializationVersion           1.1.0.1
CLRVersion                     4.0.30319.19455
BuildVersion                   10.0.10514.2
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3

Get-AzureRmAppServicePlan : The …
Run Code Online (Sandbox Code Playgroud)

powershell azure azure-powershell azure-automation

4
推荐指数
1
解决办法
1019
查看次数

Invoke-RestMethod - 如何传递"ETag不代表资源的最新状态".

如何传递具有以下消息的异常?

Invoke-RestMethod:{"Message":"ETag不代表资源的最新状态."}

看到参考,我认为"传递If-Match: "*" header"应该是关键,但不知道如何做到这一点.

注意:更新或删除文件时,将应用ETag行为.您可以传递If-Match:"*"标头以禁用ETag检查.

去做

  • 将文件"sample1.html"放到网站的特定目录中
  • 在Azure自动化帐户的Runbook中

# Kudu auth information creation
$WebSiteName = Get-AutomationVariable -Name 'WebApps_name'
# Example: "WebApps04"
$username = Get-AutomationVariable -Name 'WebApps_deploy_username'
$password = Get-AutomationVariable -Name 'WebApps_deploy_password'
# Above are set by "Asset - Variable" of in Azure Automation account

$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $username,$password)))
$userAgent = "powershell/1.0"

# Add-content dummy HTML file
$Filename = "sample1.html"
$a = "<HTML><BODY>Sample HTML Data " + $WebSiteName + "</BODY></HTML>"
$a | add-content …
Run Code Online (Sandbox Code Playgroud)

powershell azure azure-powershell azure-automation

2
推荐指数
1
解决办法
836
查看次数