예제 #1
0
        static void SetupAadCredentials(string vc)
        {
            // If you need to use Cosmos TEST clusters such as https://cosmostaurus.osdinfra.net/, please have a look at AadDogFoodHelper.cs.
            string MY_DOCUMENTS = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); //Save token in app path
                                                                                                                               //string MY_DOCUMENTS = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments);
            string TOKEN_CACHE_PATH = System.IO.Path.Combine(MY_DOCUMENTS, "my.tokencache");
            var    tokenCache       = GetTokenCache(TOKEN_CACHE_PATH);
            var    cred             = AadCredentialHelper.GetCredentialFromPrompt(tokenCache);

            //VC.SetupAadCredentials(null, null, cred);
            //VC.SetupAadCredentials("https://cosmos15.osdinfra.net/cosmos/dsa.email.segmentation", null, cred);
            VC.SetupAadCredentials(vc, null, cred);
        }