QueueTrigger를 사용하는 Azure 함수 : 저장소 계정 URL 만 구성하고 관리 ID를 사용하여 큐에 액세스 할 수 있나요?

Stef Heyenrath

이 함수를 정의했습니다.

[FunctionName("My_QueueTrigger")]
public Task RunAsync([QueueTrigger("my-queue-name", Connection = "AzureWebJobsStorage")] string text)
{
  // code here...
}

그리고 AzureWebJobsStorage(Azure에서)에는 다음이 포함됩니다."DefaultEndpointsProtocol=https;AccountName=my-storage-account;AccountKey=mykey;EndpointSuffix=core.windows.net"

(로컬 개발의 경우 값은 "UseDevelopmentStorage=true"입니다.)

내 질문은 여기에 스토리지 계정 이름을 정의 하고 Azure 함수에서 "https://my-storage-account.queue.core.windows.net"관리 ID ( 프로세서 권한이 있음)를 사용하여 메시지를 읽고 / 트리거하는 것도 가능하다는 것 입니다.

보우만 주

귀하의 요구 사항은 불가능하다고 생각합니다.

Storage에 연결된 기본 코드는 WebJob 패키지에 캡슐화되어 있으며 전체 기능의 확장 패키지에 멤버 패키지로 포함됩니다. 원하는 기능을 얻으려면 기본 코드를 수정해야합니다.

queuetrigger 속성의 소스 코드를 확인하십시오.

using System;
using System.Diagnostics;
using Microsoft.Azure.WebJobs.Description;

namespace Microsoft.Azure.WebJobs
{
    /// <summary>
    /// Attribute used to bind a parameter to an Azure Queue message, causing the function to run when a
    /// message is enqueued.
    /// </summary>
    /// <remarks>
    /// The method parameter type can be one of the following:
    /// <list type="bullet">
    /// <item><description>CloudQueueMessage</description></item>
    /// <item><description><see cref="string"/></description></item>
    /// <item><description><see cref="T:byte[]"/></description></item>
    /// <item><description>A user-defined type (serialized as JSON)</description></item>
    /// </list>
    /// </remarks>
    [AttributeUsage(AttributeTargets.Parameter)]
    [DebuggerDisplay("{QueueName,nq}")]
    [ConnectionProvider(typeof(StorageAccountAttribute))]
    [Binding]
    public sealed class QueueTriggerAttribute : Attribute, IConnectionProvider
    {
        private readonly string _queueName;

        /// <summary>Initializes a new instance of the <see cref="QueueTriggerAttribute"/> class.</summary>
        /// <param name="queueName">The name of the queue to which to bind.</param>
        public QueueTriggerAttribute(string queueName)
        {
            _queueName = queueName;
        }

        /// <summary>Gets the name of the queue to which to bind.</summary>
        public string QueueName
        {
            get { return _queueName; }
        }

        /// <summary>
        /// Gets or sets the app setting name that contains the Azure Storage connection string.
        /// </summary>
        public string Connection { get; set; }
    }
}

소스 코드를 찾을 수 있으며 저장소 URL 대신 연결 문자열을 제공해야한다고 알려줍니다.

webjobs 패키지소스 코드를 다운로드하고 queuetrigger소스 코드를 확인하면 원하는 소스 코드가 구현되지 않는 것을 알 수 있습니다. MSI를 사용하려는 기능을 말할 수 없으며이 기능을 사용할 수있는 방법도 제공하지 않습니다.

요컨대 소스 코드는 당신의 아이디어를 실현할 수 없습니다. 소스 코드의 기본 구현을 수정하지 않는 한 패키지를 다시 컴파일하고 가져 오는 것은 불가능합니다.

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

Related 관련 기사

뜨겁다태그

보관