.Net SDK를 사용하여 Recovery Services 자격 증명 모음에서 보안 PIN을 생성하는 방법은 무엇입니까?

DnyaneshSurya

현재 아래 코드로 시도하고 있지만 System.NullReferenceException : '개체 참조가 개체의 인스턴스로 설정되지 않았습니다.'.

using Microsoft.Azure.Management.RecoveryServices.Backup;
public static ISecurityPINsOperations SecurityPINs { get; }
public static class GenerateSecurityPIN
    {
        private static readonly ISecurityPINsOperations Operations1;
        var pin = await SecurityPINs.GetAsync("rsv-itops-azure-support", "rg-azure-itops-rnd-dev");
    }

아래 링크 참조 : https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.management.recoveryservices.backup.securitypinsoperationsextensions?view=azure-dotnet

제이슨 팬

Microsoft.Azure.Management.RecoveryServices.Backup -Version 4.1.5-preview아래 명령어로 설치해야합니다 .

Install-Package Microsoft.Azure.Management.RecoveryServices.Backup -Version 4.1.5-preview

그런 다음 샘플 코드는 다음과 같아야합니다 RecoveryServicesBackupClient. 먼저 생성해야합니다 .

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Azure.Management.RecoveryServices.Backup;
using Microsoft.Azure.Management.ResourceManager.Fluent;

namespace ConsoleApp2
{
    static class Program
    {
        static void Main(string[] args)
        {
            var subscriptionId = "";
            var vaultname = "";
            var resourcegroup = "";
            var credentials = SdkContext.AzureCredentialsFactory.FromFile(@"Auth file path");
            var client = new RecoveryServicesBackupClient(credentials) { SubscriptionId = subscriptionId };
            var pin = client.SecurityPINs.GetAsync(vaultname,resourcegroup).Result.SecurityPIN;
        }
    }
}

패키지 업그레이드를 원하지 않는 경우 restapi를 사용하여 PIN을 얻을 수도 있습니다 .

관련 게시물 :

Powershell 또는 C #을 사용하여 Azure '파일 및 폴더'작업 상태 가져 오기

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

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

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

Related 관련 기사

뜨겁다태그

보관