AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-17217445

play_something_good's questions

Martin Hope
play_something_good
Asked: 2025-04-02 16:42:13 +0800 CST

函数应用程序-身份提供者身份验证

  • 5

我正在尝试在允许处理请求之前向我的 Azure 函数应用程序添加身份验证。

为了避免手动处理标记化,我尝试为我的函数应用程序配置身份提供者。

我目前所做的工作: 使用以下配置创建了一个应用程序注册:

认证页面:

在此处输入图片描述

API 权限:

在此处输入图片描述

公开 API

在此处输入图片描述

身份提供者

在此处输入图片描述

问题: 当我尝试测试或运行我的函数时,我收到 401 未授权错误。我期望身份提供者自动处理身份验证。但是,当我单击默认域时,它不会请求授权。相反,会打开一个新窗口,其中包含以下屏幕: 在此处输入图片描述 在此处输入图片描述

其他观察结果:

如果我手动导航到https://func-myfunc-01.azurewebsites.net/.auth/login/aad/callback,身份验证将有效,并且我将会成功获得授权。

我的目标:

我希望在访问函数 URL 之前提示用户进行身份验证。通过身份验证后,他们应该能够执行该函数。

我做错了什么?任何指导都将不胜感激。

谢谢!

  • 1 个回答
  • 29 Views
Martin Hope
play_something_good
Asked: 2024-12-12 23:43:48 +0800 CST

使用 Bicep 进行 OpenIA 部署

  • 5

我试图在北欧部署 OpenAI 资源,但出现以下错误

异常详细信息:(InvalidApiSetId)帐户类型“OpenAI”在给定区域中无效或不可用。代码:InvalidApiSetId 消息:帐户类型“OpenAI”在给定区域中无效或不可用。

是不是在 中不可用northeurope,或者我的 API 不起作用?Belo 是我的代码,2 周前在该Westeurope地区有效

param openAIAccountName string
param location string = resourceGroup().location

param privatesubnetId string
param publicsubnetId string
param IPRules array

resource openAIAccount 'Microsoft.CognitiveServices/accounts@2024-04-01-preview' = {
  name: openAIAccountName
  location: location
  sku: {
    name: 'S0'
  }
  kind: 'OpenAI'
  properties: {
    publicNetworkAccess: 'Enabled'
    customSubDomainName: openAIAccountName
    networkAcls: {
      defaultAction: 'Deny'
      virtualNetworkRules: [
        {
          id: privatesubnetId
        }
        {
          id:publicsubnetId
        }
      ]
      ipRules: [
        for ip in IPRules: {
          value: ip
        }
      ]
    }
  }
}

resource gpt3_5 'Microsoft.CognitiveServices/accounts/deployments@2024-04-01-preview' = {
  parent: openAIAccount
  name: 'gpt35Endpoint'
  sku: {
    name: 'Standard'
    capacity: 120
  }
  properties: {
    model: {
      format: 'OpenAI'
      name: 'gpt-35-turbo'
      version: '0301'
    }
    versionUpgradeOption: 'OnceNewDefaultVersionAvailable'
    currentCapacity: 120
    raiPolicyName: 'Microsoft.Default'
  }
}
  • 1 个回答
  • 45 Views
Martin Hope
play_something_good
Asked: 2024-12-12 18:23:06 +0800 CST

yaml 文件-大写参数

  • 5

我想让我的参数大写

parameters:
  #Relative path to the BuildDirectory where artifacts are stored
  artifactLocation : ''
  env : ''
  serviceConnectionName: ''
  subscriptionId: ''
  #Arguments String to be used for the ADF deployment
  argumentsString: ''
  datafactoryName: ''
  resourceGroupName: ''
  location: ''

jobs:
- deployment: DeploymentJob
  displayName: 'Deploying Azure Data Factory'
  pool:
    name: $(agentPoolName)
  environment: "EMEA_${{ parameters.env.ToUpper() }}_MDP"  

我收到此错误:

意外符号:'('。位于表达式中的第 23 位:parameters.env.ToUpper()

什么是正确的语法?

我也尝试过这种方法

parameters:
  # Relative path to the BuildDirectory where artifacts are stored
  artifactLocation: ''
  env: ''
  serviceConnectionName: ''
  subscriptionId: ''
  # Arguments String to be used for the ADF deployment
  argumentsString: ''
  datafactoryName: ''
  resourceGroupName: ''
  location: ''

variables:
  env_upper: ${{ upper(parameters.env) }}

jobs:
- deployment: DeploymentJob
  displayName: 'Deploying Azure Data Factory'
  pool:
    name: $(agentPoolName)
  environment: 'EMEA_${{ variables.env_upper }}_MDP'

错误说它没有表达变量

我也尝试过这种方法:

environment: 'EMEA_${{ upper(parameters.env) }}_MDP'

这并没有引发错误,但没有变成大写。

yaml
  • 1 个回答
  • 15 Views
Martin Hope
play_something_good
Asked: 2024-12-04 23:14:42 +0800 CST

Databricks API - 无法列出工作区的内容

  • 5

我尝试使用 databricks API 列出我的用户下的内容。以下是我的代码

`if (-not (Get-PackageProvider -ListAvailable -Name NuGet)) { 
    Install-PackageProvider nuget -Scope CurrentUser -Force
}
if (-not (Get-Module -ListAvailable -Name azure.databricks.cicd.tools)) { 
    Install-Module -Name azure.databricks.cicd.tools -Scope CurrentUser -Force
}

Import-Module -Name azure.databricks.cicd.tools

Function Format-BearerToken ($BearerToken) {
    Return "Bearer $BearerToken"
}

try {
    # Attempt to connect to Databricks
    Connect-Databricks -BearerToken $ADB_Token -Region $region

    # List the content of the user folder
    # Assuming the user folder is "/Users/your.username" - replace with your actual user path
    $userFolderPath = "/Users/[email protected]/"  # Replace with your actual Databricks user folder path

    # Create the body as a hashtable (note the difference in creating a hashtable)
    $body = @{
        path = $userFolderPath
    }
    # Debug: Check the Body that will be sent
    $BodyText = $body | ConvertTo-Json -Depth 10
    Write-Output "Request Body: $BodyText"


    # Test the connection by making an API call to list the workspace contents in your user folder
    $workspaceContent = Invoke-DatabricksAPI -BearerToken $ADB_Token -Region $region `
        -Method GET -API "workspace/list" -Body $BodyText

    # Output the content
    $workspaceContent
}
catch {
    Write-Error "An error occurred: $_"
}`

我的路径参数输出如下所示

Request Body: {
  "path": "/Users/[email protected]/"
}

但我得到了错误

发生错误:无法处理参数“Body”的参数转换。无法将“{"path": "/Users/ [email protected] /"}“System.String”类型的值转换为“System.Collections.Hashtable”类型。

我也尝试过没有 $BodyText = $body | ConvertTo-Json -Depth 10,在这种情况下,我得到了erro code 404 - 404 RESOURCE_DOES_NOT_EXIST Operation was performed on a resource that does not exist.

我的用户名是正确的,并且我确实在其下有一个 test.py 文件。

我有两个问题:

  1. 我如何列出内容?2)由于我无法列出内容,我想如果授权成功,但其他情况下我首先会得到401 UNAUTHORIZED The request does not have valid authentication credentials for the operation.- 这是正确的吗?
  • 1 个回答
  • 32 Views
Martin Hope
play_something_good
Asked: 2024-11-22 02:34:50 +0800 CST

使用 Bicep 的 RBAC

  • 5

我尝试使用子级别所有者的服务主体将 AD 组作为贡献者分配给我的存储帐户,并将存储 blob 数据贡献者分配给该帐户。

param storageAccountName string
param roleId array
param adGroup string
param principalType string = 'Group'

// reference to storage account
resource storageAccount 'Microsoft.Storage/storageAccounts@2023-01-01' existing = {
  name: storageAccountName
}

resource roleAssignment1 'Microsoft.Authorization/roleAssignments@2022-04-01' = [for roleId in roleId:  {
  name: guid(subscription().subscriptionId, resourceGroup().name, storageAccountName, roleId, adGroup)
  scope: storageAccount
  properties: {
    roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', roleId)
    principalId: adGroup
    principalType: principalType
  }
}
]

我收到这个错误

code":"GroupTypeNotSupported","message":"Only security-enabled groups can be used in role assignments."}
  • 1 个回答
  • 17 Views
Martin Hope
play_something_good
Asked: 2024-11-21 00:13:39 +0800 CST

逻辑应用授权失败 - 需要 vnet 集成

  • 6

我正在尝试让我的环境更安全一些。我已为我的存储帐户添加了专用端点。

但现在的问题是我的逻辑应用程序无法访问并失败

"body": {
    "message": "AuthorizationFailure\r\nclientRequestId: 7772864e-9a15-41ca-b02f-xxxxx",
    "status": 403,
    "error": {
        "message": "AuthorizationFailure"
    },
    "source": "azureblob-we.azconn-we-003.p.azurewebsites.net"
}

逻辑对我来说是新东西,因此,我很感激您对如何将 Vnet 集成添加到现有逻辑应用程序中的意见。

我认为我在谷歌上找到的资料有点过时,因为我的用户界面略有不同,因为我在左侧面板的设置下没有看到任何地方有“网络”选项卡。

在此处输入图片描述

  • 1 个回答
  • 45 Views
Martin Hope
play_something_good
Asked: 2024-03-04 20:54:57 +0800 CST

为资源添加标签 - power shell

  • 5

我尝试在部署资源组时将标签分配给资源组。我还使用定义了变量的 ini 文件。

这是我的两个函数,读取 ini 文件并创建资源组

    function Get-IniContent ($filePath)
{
    $ini = @{}
    switch -regex -file $FilePath
    {
        "^\[(.+)\]" # Section
        {
            $section = $matches[1]
            $ini[$section] = @{}
            $CommentCount = 0
        }
        "^(;.*)$" # Comment
        {
            $value = $matches[1]
            $CommentCount = $CommentCount + 1
            $name = "Comment" + $CommentCount
            $ini[$section][$name] = $value
        }
        "(.+?)\s*=(.*)" # Key
        {
            $name,$value = $matches[1..2]
            $ini[$section][$name] = $value
        }
    }
    return $ini
}


function Create-ResourceGroup {
    param (
        [string] $rgName,
        [string] $saName,
        [hashtable] $tags
    )
    
    az group create --name $rgName --location "westeurope" --tags $tags


}

我有一个单独的文件,我在其中调用此函数,如下所示:

. ".\functions.ps1"

# Get variables from the INI file
$iniFilePath = "../configuration/variables.ini"
$iniContent = Get-IniContent $iniFilePath

# Get today's date
$today = Get-Date -Format yyyy-MM-dd
$trainerName = $iniContent["project"]["trainer"]
$projectName = $iniContent["project"]["name"]

$tags = @{
    "CreationDate" = $today
    "Trainer" = $trainerName
    "Project" = $projectName
}

# Iterate over the trainees section
foreach ($key in $iniContent["trainees"].Keys) {
    # Get the trainee name
    $traineeName = $iniContent["trainees"][$key]


    $names = $traineeName -split ' '
    $lastname = ($traineeName -split ' ')[1].Substring(0, [Math]::Min(5, $traineeName.IndexOf(" "))).ToLower()
    # RG name
    $resourceGroupName = "rg-academy-databricks-$lastname"
    # SA name
    $storageName = "stacademy$lastname"
    # DB name
    $databricksName = "dbs-academy-course-$lastname-001"


    # Call function to create resources

    Create-ResourceGroup -rgName $resourceGroupName -saName $storageName -tags $tags


}

代码不会失败,但我定义的标签没有通过,而是我看到 System.Collections.Hashtable :如下图所示。我确实尝试了泼溅并替换--tags $tags为--tags @tags但确实抛出了错误Missing an argument for parameter 'tags'

在此输入图像描述

  • 1 个回答
  • 40 Views
Martin Hope
play_something_good
Asked: 2024-01-03 22:43:41 +0800 CST

错误:迭代不可迭代的值 - terraform

  • 6

我对 terraform 很陌生,不明白我做错了什么。我的目标是根据每个值可以具有的特定单词来过滤列表。

所以我的模块看起来像这样,我定义了pipeline_list

    module "pipelines" {
  source = "./pipelines"

  for_each = var.pipelines

  project_id    = data.azuredevops_project.dataanalytics.id
  repo_id       = module.repositories[each.key].repo_id
  pipeline_list = each.value
  group_ids = local.group_ids
}

pipelinestfvars 文件本身看起来像这样

    pipelines = {
  Infrastructure = [
    "pipelines/BI-Infrastructure-IaC-CI.yml",
    "pipelines/BI-Infrastructure-IaC-Deploy.yml"
  ],
  Applications = [
    "datafactory/pipelines/DataAnalytics-Datafactory-Test.yml",
    "datafactory/pipelines/DataAnalytics-Datafactory-CI.yml",
    "datafactory/pipelines/DataAnalytics-Datafactory-Deploy.yml",
    "databricks/pipelines/BI-Applications-Databricks-CI.yml",
    "databricks/pipelines/BI-Applications-Databricks-Deploy.yml"
  ]
}

我想过滤此列表并仅选择其中包含“部署”的值。

我的尝试如下所示:

locals {
  deploy_pipelines = flatten([
    for project, pipelines in var.pipeline_list : [
      for pipeline in pipelines : 
        contains(pipeline, "Deploy") ? pipeline : null
    ]
  ])
}

但我收到错误消息

在此输入图像描述

请帮忙 idnetify 我在哪里做mistkae?

编辑: 我已经以这种方式更改了当地人,我认为我正在做额外的循环,因为项目不在那里。但我现在收到新错误,提示“调用函数“包含”失败:参数必须是列表、元组或集合”。

locals {
  deploy_pipelines = flatten([
    for pipeline in var.pipeline_list : 
        contains(pipeline, "Deploy") ? pipeline : null
    ]
  )
    }
terraform
  • 1 个回答
  • 30 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    重新格式化数字,在固定位置插入分隔符

    • 6 个回答
  • Marko Smith

    为什么 C++20 概念会导致循环约束错误,而老式的 SFINAE 不会?

    • 2 个回答
  • Marko Smith

    VScode 自动卸载扩展的问题(Material 主题)

    • 2 个回答
  • Marko Smith

    Vue 3:创建时出错“预期标识符但发现‘导入’”[重复]

    • 1 个回答
  • Marko Smith

    具有指定基础类型但没有枚举器的“枚举类”的用途是什么?

    • 1 个回答
  • Marko Smith

    如何修复未手动导入的模块的 MODULE_NOT_FOUND 错误?

    • 6 个回答
  • Marko Smith

    `(表达式,左值) = 右值` 在 C 或 C++ 中是有效的赋值吗?为什么有些编译器会接受/拒绝它?

    • 3 个回答
  • Marko Smith

    在 C++ 中,一个不执行任何操作的空程序需要 204KB 的堆,但在 C 中则不需要

    • 1 个回答
  • Marko Smith

    PowerBI 目前与 BigQuery 不兼容:Simba 驱动程序与 Windows 更新有关

    • 2 个回答
  • Marko Smith

    AdMob:MobileAds.initialize() - 对于某些设备,“java.lang.Integer 无法转换为 java.lang.String”

    • 1 个回答
  • Martin Hope
    Fantastic Mr Fox msvc std::vector 实现中仅不接受可复制类型 2025-04-23 06:40:49 +0800 CST
  • Martin Hope
    Howard Hinnant 使用 chrono 查找下一个工作日 2025-04-21 08:30:25 +0800 CST
  • Martin Hope
    Fedor 构造函数的成员初始化程序可以包含另一个成员的初始化吗? 2025-04-15 01:01:44 +0800 CST
  • Martin Hope
    Petr Filipský 为什么 C++20 概念会导致循环约束错误,而老式的 SFINAE 不会? 2025-03-23 21:39:40 +0800 CST
  • Martin Hope
    Catskul C++20 是否进行了更改,允许从已知绑定数组“type(&)[N]”转换为未知绑定数组“type(&)[]”? 2025-03-04 06:57:53 +0800 CST
  • Martin Hope
    Stefan Pochmann 为什么 {2,3,10} 和 {x,3,10} (x=2) 的顺序不同? 2025-01-13 23:24:07 +0800 CST
  • Martin Hope
    Chad Feller 在 5.2 版中,bash 条件语句中的 [[ .. ]] 中的分号现在是可选的吗? 2024-10-21 05:50:33 +0800 CST
  • Martin Hope
    Wrench 为什么双破折号 (--) 会导致此 MariaDB 子句评估为 true? 2024-05-05 13:37:20 +0800 CST
  • Martin Hope
    Waket Zheng 为什么 `dict(id=1, **{'id': 2})` 有时会引发 `KeyError: 'id'` 而不是 TypeError? 2024-05-04 14:19:19 +0800 CST
  • Martin Hope
    user924 AdMob:MobileAds.initialize() - 对于某些设备,“java.lang.Integer 无法转换为 java.lang.String” 2024-03-20 03:12:31 +0800 CST

热门标签

python javascript c++ c# java typescript sql reactjs html

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve