현재 아래 코드로 시도하고 있지만 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");
}
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을 얻을 수도 있습니다 .
관련 게시물 :
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다