Skip to content

Commit 972ca77

Browse files
committed
Merge branch 'main' of https://github.com/MicrosoftDocs/azure-docs-pr into premNew
2 parents 31d4463 + fcbec5e commit 972ca77

File tree

249 files changed

+1492
-4191
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

249 files changed

+1492
-4191
lines changed

.openpublishing.redirection.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13764,6 +13764,31 @@
1376413764
"redirect_url": "/azure/scheduler/migrate-from-scheduler-to-logic-apps",
1376513765
"redirect_document_id": ""
1376613766
},
13767+
{
13768+
"source_path_from_root": "/articles/search/tutorial-csharp-create-first-app.md",
13769+
"redirect_url": "/previous-versions/azure/search/tutorial-csharp-create-first-app",
13770+
"redirect_document_id": false
13771+
},
13772+
{
13773+
"source_path_from_root": "/articles/search/tutorial-csharp-paging.md",
13774+
"redirect_url": "/previous-versions/azure/search/tutorial-csharp-paging",
13775+
"redirect_document_id": false
13776+
},
13777+
{
13778+
"source_path_from_root": "/articles/search/tutorial-csharp-type-ahead-and-suggestions.md",
13779+
"redirect_url": "/previous-versions/azure/search/tutorial-csharp-type-ahead-and-suggestions",
13780+
"redirect_document_id": false
13781+
},
13782+
{
13783+
"source_path_from_root": "/articles/search/tutorial-csharp-facets.md",
13784+
"redirect_url": "/previous-versions/azure/search/tutorial-csharp-facets",
13785+
"redirect_document_id": false
13786+
},
13787+
{
13788+
"source_path_from_root": "/articles/search/tutorial-csharp-orders.md",
13789+
"redirect_url": "/previous-versions/azure/search/tutorial-csharp-orders",
13790+
"redirect_document_id": false
13791+
},
1376713792
{
1376813793
"source_path_from_root": "/articles/search/cognitive-search-tutorial-aml-designer-custom-skill.md",
1376913794
"redirect_url": "/previous-versions/azure/search/cognitive-search-tutorial-aml-designer-custom-skill",

articles/active-directory/authentication/how-to-authentication-methods-manage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ To check settings in the Authentication methods policy, sign in as an [Authentic
7474

7575
:::image type="content" source="media/concept-authentication-methods-manage/authentication-methods-policy.png" alt-text="Screenshot that shows the authentication methods." lightbox="media/concept-authentication-methods-manage/authentication-methods-policy.png":::
7676

77-
The Authentication methods policy has other methods that aren't available in the legacy policies, such as FIDO2 security key, Temporary Access Pass, and Azure AD certificate-based authentication. These methods aren't in scope for migration and you won't need to make any changes to them if you've them configured already.
77+
The Authentication methods policy has other methods that aren't available in the legacy policies, such as FIDO2 security key, Temporary Access Pass, and Azure AD certificate-based authentication. These methods aren't in scope for migration and you won't need to make any changes to them if you've configured them already.
7878

7979
If you've enabled other methods in the Authentication methods policy, write down the users and groups who can or can't use those methods. Take a note of the configuration parameters that govern how the method can be used. For example, you can configure Microsoft Authenticator to provide location in push notifications. Make a record of which users and groups are enabled for similar configuration parameters associated with each method.
8080

articles/active-directory/develop/msal-compare-msal-js-and-adal-js.md

Lines changed: 195 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -316,71 +316,110 @@ The snippets below demonstrates the minimal code required for a single-page appl
316316
```html
317317

318318
<head>
319-
<meta charset="UTF-8">
320-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
321-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
322-
323-
<script
324-
type="text/javascript"
325-
src="https://secure.aadcdn.microsoftonline-p.com/lib/1.0.18/js/adal.min.js">
326-
</script>
319+
<meta charset="UTF-8">
320+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
321+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
322+
<script type="text/javascript" src="https://alcdn.msauth.net/lib/1.0.18/js/adal.min.js"></script>
327323
</head>
328324

329-
<div>
330-
<button id="loginButton">Login</button>
331-
<button id="logoutButton" style="visibility: hidden;">Logout</button>
332-
<button id="tokenButton" style="visibility: hidden;">Get Token</button>
333-
</div>
334-
335325
<body>
336-
<script>
337-
338-
const loginButton = document.getElementById("loginButton");
339-
const logoutButton = document.getElementById("logoutButton");
340-
const tokenButton = document.getElementById("tokenButton");
341-
342-
var authContext = new AuthenticationContext({
343-
instance: 'https://login.microsoftonline.com/',
344-
clientId: "ENTER_CLIENT_ID",
345-
tenant: "ENTER_TENANT_ID",
346-
cacheLocation: "sessionStorage",
347-
redirectUri: "http://localhost:3000",
348-
popUp: true,
349-
callback: function (errorDesc, token, error, tokenType) {
350-
console.log('Hello ' + authContext.getCachedUser().profile.upn)
326+
<div>
327+
<p id="welcomeMessage" style="visibility: hidden;"></p>
328+
<button id="loginButton">Login</button>
329+
<button id="logoutButton" style="visibility: hidden;">Logout</button>
330+
<button id="tokenButton" style="visibility: hidden;">Get Token</button>
331+
</div>
332+
<script>
333+
// DOM elements to work with
334+
var welcomeMessage = document.getElementById("welcomeMessage");
335+
var loginButton = document.getElementById("loginButton");
336+
var logoutButton = document.getElementById("logoutButton");
337+
var tokenButton = document.getElementById("tokenButton");
338+
339+
// if user is logged in, update the UI
340+
function updateUI(user) {
341+
if (!user) {
342+
return;
343+
}
351344
352-
loginButton.style.visibility = "hidden";
345+
welcomeMessage.innerHTML = 'Hello ' + user.profile.upn + '!';
346+
welcomeMessage.style.visibility = "visible";
353347
logoutButton.style.visibility = "visible";
354348
tokenButton.style.visibility = "visible";
355-
}
356-
});
357-
358-
authContext.log({
359-
level: 3,
360-
log: function (message) {
361-
console.log(message);
362-
},
363-
piiLoggingEnabled: false
364-
});
365-
366-
loginButton.addEventListener('click', function () {
367-
authContext.login();
368-
});
369-
370-
logoutButton.addEventListener('click', function () {
371-
authContext.logOut();
372-
});
373-
374-
tokenButton.addEventListener('click', () => {
375-
authContext.acquireTokenPopup(
376-
"https://graph.microsoft.com",
377-
null, null,
378-
function (error, token) {
379-
console.log(error, token);
349+
loginButton.style.visibility = "hidden";
350+
};
351+
352+
// attach logger configuration to window
353+
window.Logging = {
354+
piiLoggingEnabled: false,
355+
level: 3,
356+
log: function (message) {
357+
console.log(message);
380358
}
381-
)
382-
});
383-
</script>
359+
};
360+
361+
// ADAL configuration
362+
var adalConfig = {
363+
instance: 'https://login.microsoftonline.com/',
364+
clientId: "ENTER_CLIENT_ID_HERE",
365+
tenant: "ENTER_TENANT_ID_HERE",
366+
redirectUri: "ENTER_REDIRECT_URI_HERE",
367+
cacheLocation: "sessionStorage",
368+
popUp: true,
369+
callback: function (errorDesc, token, error, tokenType) {
370+
if (error) {
371+
console.log(error, errorDesc);
372+
} else {
373+
updateUI(authContext.getCachedUser());
374+
}
375+
}
376+
};
377+
378+
// instantiate ADAL client object
379+
var authContext = new AuthenticationContext(adalConfig);
380+
381+
// handle redirect response or check for cached user
382+
if (authContext.isCallback(window.location.hash)) {
383+
authContext.handleWindowCallback();
384+
} else {
385+
updateUI(authContext.getCachedUser());
386+
}
387+
388+
// attach event handlers to button clicks
389+
loginButton.addEventListener('click', function () {
390+
authContext.login();
391+
});
392+
393+
logoutButton.addEventListener('click', function () {
394+
authContext.logOut();
395+
});
396+
397+
tokenButton.addEventListener('click', () => {
398+
authContext.acquireToken(
399+
"https://graph.microsoft.com",
400+
function (errorDesc, token, error) {
401+
if (error) {
402+
console.log(error, errorDesc);
403+
404+
authContext.acquireTokenPopup(
405+
"https://graph.microsoft.com",
406+
null, // extraQueryParameters
407+
null, // claims
408+
function (errorDesc, token, error) {
409+
if (error) {
410+
console.log(error, errorDesc);
411+
} else {
412+
console.log(token);
413+
}
414+
}
415+
);
416+
} else {
417+
console.log(token);
418+
}
419+
}
420+
);
421+
});
422+
</script>
384423
</body>
385424

386425
</html>
@@ -393,72 +432,111 @@ The snippets below demonstrates the minimal code required for a single-page appl
393432
```html
394433

395434
<head>
396-
<meta charset="UTF-8">
397-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
398-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
399-
400-
<script
401-
type="text/javascript"
402-
src="https://alcdn.msauth.net/browser/2.14.2/js/msal-browser.min.js">
403-
</script>
435+
<meta charset="UTF-8">
436+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
437+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
438+
<script type="text/javascript" src="https://alcdn.msauth.net/browser/2.34.0/js/msal-browser.min.js"></script>
404439
</head>
405440

406-
<div>
407-
<button id="loginButton">Login</button>
408-
<button id="logoutButton" style="visibility: hidden;">Logout</button>
409-
<button id="tokenButton" style="visibility: hidden;">Get Token</button>
410-
</div>
411-
412441
<body>
413-
<script>
414-
const loginButton = document.getElementById("loginButton");
415-
const logoutButton = document.getElementById("logoutButton");
416-
const tokenButton = document.getElementById("tokenButton");
417-
418-
const pca = new msal.PublicClientApplication({
419-
auth: {
420-
clientId: "ENTER_CLIENT_ID",
421-
authority: "https://login.microsoftonline.com/ENTER_TENANT_ID",
422-
redirectUri: "http://localhost:3000",
423-
},
424-
cache: {
425-
cacheLocation: "sessionStorage"
426-
},
427-
system: {
428-
loggerOptions: {
429-
loggerCallback(loglevel, message, containsPii) {
430-
console.log(message);
431-
},
432-
piiLoggingEnabled: false,
433-
logLevel: msal.LogLevel.Verbose,
442+
<div>
443+
<p id="welcomeMessage" style="visibility: hidden;"></p>
444+
<button id="loginButton">Login</button>
445+
<button id="logoutButton" style="visibility: hidden;">Logout</button>
446+
<button id="tokenButton" style="visibility: hidden;">Get Token</button>
447+
</div>
448+
<script>
449+
// DOM elements to work with
450+
const welcomeMessage = document.getElementById("welcomeMessage");
451+
const loginButton = document.getElementById("loginButton");
452+
const logoutButton = document.getElementById("logoutButton");
453+
const tokenButton = document.getElementById("tokenButton");
454+
455+
// if user is logged in, update the UI
456+
const updateUI = (account) => {
457+
if (!account) {
458+
return;
434459
}
435-
}
436-
});
437-
438-
loginButton.addEventListener('click', () => {
439-
pca.loginPopup().then((response) => {
440-
console.log(`Hello ${response.account.username}!`);
441460
442-
loginButton.style.visibility = "hidden";
461+
welcomeMessage.innerHTML = `Hello ${account.username}!`;
462+
welcomeMessage.style.visibility = "visible";
443463
logoutButton.style.visibility = "visible";
444464
tokenButton.style.visibility = "visible";
445-
})
446-
});
447-
448-
logoutButton.addEventListener('click', () => {
449-
pca.logoutPopup().then((response) => {
450-
window.location.reload();
451-
})
452-
});
453-
454-
tokenButton.addEventListener('click', () => {
455-
pca.acquireTokenPopup({
456-
scopes: ["User.Read"]
457-
}).then((response) => {
458-
console.log(response);
459-
})
460-
});
461-
</script>
465+
loginButton.style.visibility = "hidden";
466+
};
467+
468+
// MSAL configuration
469+
const msalConfig = {
470+
auth: {
471+
clientId: "ENTER_CLIENT_ID_HERE",
472+
authority: "https://login.microsoftonline.com/ENTER_TENANT_ID_HERE",
473+
redirectUri: "ENTER_REDIRECT_URI_HERE",
474+
},
475+
cache: {
476+
cacheLocation: "sessionStorage"
477+
},
478+
system: {
479+
loggerOptions: {
480+
loggerCallback(loglevel, message, containsPii) {
481+
console.log(message);
482+
},
483+
piiLoggingEnabled: false,
484+
logLevel: msal.LogLevel.Verbose,
485+
}
486+
}
487+
};
488+
489+
// instantiate MSAL client object
490+
const pca = new msal.PublicClientApplication(msalConfig);
491+
492+
// handle redirect response or check for cached user
493+
pca.handleRedirectPromise().then((response) => {
494+
if (response) {
495+
pca.setActiveAccount(response.account);
496+
updateUI(response.account);
497+
} else {
498+
const account = pca.getAllAccounts()[0];
499+
updateUI(account);
500+
}
501+
}).catch((error) => {
502+
console.log(error);
503+
});
504+
505+
// attach event handlers to button clicks
506+
loginButton.addEventListener('click', () => {
507+
pca.loginPopup().then((response) => {
508+
pca.setActiveAccount(response.account);
509+
updateUI(response.account);
510+
})
511+
});
512+
513+
logoutButton.addEventListener('click', () => {
514+
pca.logoutPopup().then((response) => {
515+
window.location.reload();
516+
});
517+
});
518+
519+
tokenButton.addEventListener('click', () => {
520+
const account = pca.getActiveAccount();
521+
522+
pca.acquireTokenSilent({
523+
account: account,
524+
scopes: ["User.Read"]
525+
}).then((response) => {
526+
console.log(response);
527+
}).catch((error) => {
528+
if (error instanceof msal.InteractionRequiredAuthError) {
529+
pca.acquireTokenPopup({
530+
scopes: ["User.Read"]
531+
}).then((response) => {
532+
console.log(response);
533+
});
534+
}
535+
536+
console.log(error);
537+
});
538+
});
539+
</script>
462540
</body>
463541

464542
</html>

articles/active-directory/develop/msal-net-token-cache-serialization.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ var app = ConfidentialClientApplicationBuilder
378378
### Samples
379379

380380
- The following sample showcases using the token cache serializers in .NET Framework and .NET Core applications: [ConfidentialClientTokenCache](https://github.com/Azure-Samples/active-directory-dotnet-v1-to-v2/tree/master/ConfidentialClientTokenCache).
381-
- The following sample is an ASP.NET web app that uses the same technics: [Use OpenID Connect to sign in users to Microsoft identity platform](https://github.com/Azure-Samples/ms-identity-aspnet-webapp-openidconnect). For the full code, see [WebApp/Utils/MsalAppBuilder.cs](https://github.com/Azure-Samples/ms-identity-aspnet-webapp-openidconnect/blob/master/WebApp/Utils/MsalAppBuilder.cs).
381+
- The following sample is an ASP.NET web app that uses the same technics: [Use OpenID Connect to sign in users to Microsoft identity platform](https://github.com/Azure-Samples/ms-identity-aspnet-webapp-openidconnect).
382382
383383
## [Desktop apps](#tab/desktop)
384384

@@ -572,4 +572,4 @@ The following samples illustrate token cache serialization.
572572
| ------ | -------- | ----------- |
573573
|[active-directory-dotnet-desktop-msgraph-v2](https://github.com/azure-samples/active-directory-dotnet-desktop-msgraph-v2) | Desktop (WPF) | Windows Desktop .NET (WPF) application that calls the Microsoft Graph API. ![Diagram that shows a topology with a desktop app client flowing to Azure Active Directory by acquiring a token interactively and to Microsoft Graph.](media/msal-net-token-cache-serialization/topology.png)|
574574
|[active-directory-dotnet-v1-to-v2](https://github.com/Azure-Samples/active-directory-dotnet-v1-to-v2) | Desktop (console) | Set of Visual Studio solutions that illustrate the migration of Azure AD v1.0 applications (using ADAL.NET) to Microsoft identity platform applications (using MSAL.NET). In particular, see [Token cache migration](https://github.com/Azure-Samples/active-directory-dotnet-v1-to-v2/blob/master/TokenCacheMigration/README.md) and [Confidential client token cache](https://github.com/Azure-Samples/active-directory-dotnet-v1-to-v2/tree/master/ConfidentialClientTokenCache). |
575-
[ms-identity-aspnet-webapp-openidconnect](https://github.com/Azure-Samples/ms-identity-aspnet-webapp-openidconnect) | ASP.NET (net472) | Example of token cache serialization in an ASP.NET MVC application (using MSAL.NET). In particular, see [MsalAppBuilder](https://github.com/Azure-Samples/ms-identity-aspnet-webapp-openidconnect/blob/master/WebApp/Utils/MsalAppBuilder.cs).
575+
[ms-identity-aspnet-webapp-openidconnect](https://github.com/Azure-Samples/ms-identity-aspnet-webapp-openidconnect) | ASP.NET (net472) | Example of token cache serialization in an ASP.NET MVC application (using MSAL.NET).

0 commit comments

Comments
 (0)