Microsoft’s October 17, 2018 announcement of a new method to disable basic authentication for connections to Exchange Online is very welcome. Why? Basic authentication means what it says – a basic mechanism to authenticate a connection to a service. Basic authentication is simple to use and simple to abuse, which is why attackers try to exploit its simplicity in exploits like password spraying attacks and business email compromise. An Exchange authentication policy is a simple and effective way to stop attackers because it blocks attempts to connect to Azure AD accounts before authentication occurs.
Exchange Online supports many different connection protocols from Exchange ActiveSync to POP3 to IMAP4 to MAPI. This is a good thing because it allows people to use their client of choice to connect to their mailbox. Unfortunately, the profusion of connection protocols creates a difficulty too because each must be secured to stop penetration by attackers.
Update: On October 1, 2022, Microsoft entered the final phase of its project to remove basic authentication connectivity for seven email protocols. Organizations that want to protect themselves from drive-by password spray attacks before Microsoft disables basic authentication by deploying an authentication policy to block the protocols most exploited by attackers like IMAP4, POP3, and SMTP. The great advantage of an authentication policy is that it blocks a connection before it gets to Azure AD authentication. Because the policy refuses connections over blocked protocols, attackers never get to test stolen or made-up credentials against a tenant.
Creating an Exchange Authentication Policy
The method now available introduces a new cmdlet set to create and manage protocol authentication policies. Running the New-AuthenticationPolicy cmdlet creates an authentication policy that disables basic authentication for all the protocols supported by Exchange Online. For example:
Before you block basic authentication, you must enable modern authentication for your tenant and be sure that users have clients that support modern authentication, like Outlook 2016. Enabling a block on basic authentication will have an immediate effect on older clients if you’re not careful. See this support article for more details.
Changing Protocol Authentication Settings
If you want to change a setting to allow basic authentication for a protocol, run the Set-AuthenticationPolicy cmdlet. For example:
Set-AuthenticationPolicy -Identity "No Basic Auth" -AllowBasicAuthPop:$True
You can have multiple authentication policies in a tenant, each of which allows basic authentication for different protocols.
Assigning Policies to Users
After you’ve created the authentication policies you need, you assign them to user accounts to tell Exchange Online whether users can connect using basic authentication.
In my tenant, I decided to have a single policy applied to all user accounts and implement the policy immediately, which means that you also reset the baseline for user refresh tokens. This has to be done with PowerShell, so I used a command to find all user mailboxes and use the Set-User cmdlet to assign the authentication policy and reset the refresh token for the account to the current date and time. This will force Exchange to request clients using basic authentication for connections to reauthenticate using modern authentication.
To check that policies are in place as you intend, check the accounts by running the Get-User cmdlet. As shown below, you should see that each account is assigned the desired authentication policy and the refresh token is reset to the time when the Set-User cmdlet executed.
Get-Recipient -RecipientTypeDetails UserMailbox -ResultSize Unlimited | Get-User | Format-Table
DisplayName, AuthenticationPolicy, Sts*
DisplayName AuthenticationPolicy StsRefreshTokensValidFrom
----------- -------------------- -------------------------
Deirdre Smith No Basic Auth 18 Oct 2018 14:30:42
Tony Redmond No Basic Auth 18 Oct 2018 14:31:06
TempAdminAC No Basic Auth 18 Oct 2018 14:31:11
Defining a Default Protocol Authentication Policy
New user accounts are assigned the default protocol authentication policy for the tenant. Unless you define a default protocol authentication policy in the organization configuration, the value assigned to new accounts is $Null, meaning that no policy is assigned. To change this, run the Set-OrganizationConfig cmdlet and define a new default:
Set-OrganizationConfig -DefaultAuthenticationPolicy "No Basic Auth"
You can check the value with the Get-OrganizationConfig cmdlet:
Get-OrganizationConfig | fl DefaultAuthenticationPolicy
DefaultAuthenticationPolicy : No Basic Auth
All Good So Far
The block on basic authentication has been in place in my tenant for a few days now and no problems have been seen so far. Apart from finding out whether people use obsolete clients to connect to mailboxes, the biggest issue you might face is that disabling basic authentication for PowerShell forces accounts to use multi-factor authentication when they connect to Exchange Online.
If a problem was encountered, it’s easily fixed by reversing course and either removing the authentication policy from the affected user accounts or allowing basic authentication for a specific protocol. To remove a policy, run Set-User again:
No events are recorded in the Office 365 Audit Log to show that someone’s account was blocked for basic authentication. But this is a preview that’s designed to show customers what’s coming down the tracks and it’s likely that Microsoft will improve this aspect of the implementation when protocol authentication policies are generally available.
Limiting basic authentication for connections using a protocol policy only affects Exchange Online and has no influence over any other Office 365 workload.
Exchange Online is covered in Chapter 5 of the Office 365 for IT Pros eBook. Then again, Exchange is used by many Office 365 applications, so it turns up throughout the book.
“Disabling basic authentication for PowerShell forces accounts to use multi-factor authentication when they connect to Exchange Online.”
I know that disabling basic auth forces the use of Exchange Online PowerShell (which is available via EAC/Hybrid, of all places), but is it really the case that that module itself requires MFA? Yes, it’s closely associated with MFA, as supporting MFA was the reason that it was developed, but I thought that Connect-EXOPSSession worked without it.
That must be it, since the normal way of connecting to Exchange Online in PowerShell seems to be working just fine here on pure basic auth (i.e. no exception for PowerShell). I think MS could have made this a tad clearer, since they said “If you block Basic authentication for Exchange Online PowerShell, you need to use the Exchange Online PowerShell Module to connect.”
To follow-up on the PowerShell/Exchange comment, I just hadn’t waited long enough. Refreshing the token apparently isn’t foolproof, since being cut off from PowerShell (for Exchange Online) took about a day (“AccessDenied”). So, it is true that pure basic auth forces the use of the new module, Exchange Online PowerShell, but it in turn doesn’t force MFA.
What time did you set for the token refresh when you assigned the policy to mailboxes. If you set it to be the current time, all existing tokens are cancelled and access needs to be reauthenticated immediately.
Yes, it was the same command that you show above, ending in UtcNow. But I ran my usual PowerShell batch many times in the day since then, and it always worked without incident, until this morning. Not a big deal, and it makes MS’s sentence about it exactly right, but my usual all-in-one script will need to be adapted for the new module (there are some lengthy threads around about how to do that). As a standalone, the new module works fine.
Those who did this back in the day might want to run the “Checking Policies Are Applied to Accounts” command above. When I did that again after all these years, I was surprised to find that about half the accounts did not have the (lone) existing policy applied, and this is despite having used the “Defining a Default Protocol Authentication Policy” command back then (it still shows set today).
The accounts in question are all new ones from over the last few years (since implementing the policy). While these accounts are blank in the AuthenticationPolicy column, the StsRefreshTokensValidFrom for a great many of these same ones have 2020 and 2021 dates. I’m not sure what to make of that, but I think the former column holds more weight than the latter, right?
In any case, today I ran the “Assigning Policies to Users” command for the first time since back then, and it all looks good again. But obviously I’ll have to set a reminder for myself to look at this a month or two from now to see what happens with newly created mailboxes. Maybe this was all a hiccup and won’t happen again.
Yes, so new accounts are blank for AuthenticationPolicy despite a StsRefreshTokensValidFrom date. This suggests to me that new users are not included in the default policy, which is not good since it involves manual intervention each time.
Hello quick question, for a customer that has a tenant prior to authentication policies being a thing therefore the tenant had no authentication policy, when creating a new authentication policy and making it the default policy for the organization, is it expected that new users created after the authentication policy being made default is still listed as an authentication policy of “null” ?
I think I answered the same question on the Practical365.com site just now… The answer is that when a user account shows null for the authentication policy, Exchange Online applies the default organization policy (the one managed through the Microsoft 365 admin center). If you want to use a non-default policy, you must assign the policies with Set-User and remember to do this when new accounts are created.
Hello Tony, Thanks for the quick reply! This makes sense now, I created an authentication policy and made it the default policy via PowerShell, and I now see the settings I made to block basic auth are visible in the “Modern Authentication” service in “Org Settings” on the M365 admin center. I was just hung up on the fact new users auth policy was still null, I was expecting to list the policy name (even if its default)
Thanks Again!
Loading...
Peter, I’m glad you brought this up (I had the same question in July). Since it’s not really practical to continue to revisit this as new users are added (something that I didn’t even know was needed until I happened to notice it in July), and also because no customization is needed here, I just ditched our circa 2018 policy and went with the one that Admin creates automatically (augmented by manually disabling AllowBasicAuthOutlookService and AllowBasicAuthReportingWebServices, since they aren’t otherwise covered), and then applied that to all existing accounts.
As I understand it, that should be the end of this going forward; new accounts, as Tony suggests, will fall under this “default” policy and actually see it applied to them. It’s unclear to me why the original policy (now gone) created via PowerShell, especially since it was the default (and only) policy, wouldn’t have enjoyed the same benefit for new users.
{"id":null,"mode":"button","open_style":"in_modal","currency_code":"EUR","currency_symbol":"\u20ac","currency_type":"decimal","blank_flag_url":"https:\/\/office365itpros.com\/wp-content\/plugins\/tip-jar-wp\/\/assets\/images\/flags\/blank.gif","flag_sprite_url":"https:\/\/office365itpros.com\/wp-content\/plugins\/tip-jar-wp\/\/assets\/images\/flags\/flags.png","default_amount":100,"top_media_type":"featured_image","featured_image_url":"https:\/\/office365itpros.com\/wp-content\/uploads\/2022\/11\/cover-141x200.jpg","featured_embed":"","header_media":null,"file_download_attachment_data":null,"recurring_options_enabled":true,"recurring_options":{"never":{"selected":true,"after_output":"One time only"},"weekly":{"selected":false,"after_output":"Every week"},"monthly":{"selected":false,"after_output":"Every month"},"yearly":{"selected":false,"after_output":"Every year"}},"strings":{"current_user_email":"","current_user_name":"","link_text":"Virtual Tip Jar","complete_payment_button_error_text":"Check info and try again","payment_verb":"Pay","payment_request_label":"Office 365 for IT Pros","form_has_an_error":"Please check and fix the errors above","general_server_error":"Something isn't working right at the moment. Please try again.","form_title":"Office 365 for IT Pros","form_subtitle":null,"currency_search_text":"Country or Currency here","other_payment_option":"Other payment option","manage_payments_button_text":"Manage your payments","thank_you_message":"Thank you for supporting the work of Office 365 for IT Pros!","payment_confirmation_title":"Office 365 for IT Pros","receipt_title":"Your Receipt","print_receipt":"Print Receipt","email_receipt":"Email Receipt","email_receipt_sending":"Sending receipt...","email_receipt_success":"Email receipt successfully sent","email_receipt_failed":"Email receipt failed to send. Please try again.","receipt_payee":"Paid to","receipt_statement_descriptor":"This will show up on your statement as","receipt_date":"Date","receipt_transaction_id":"Transaction ID","receipt_transaction_amount":"Amount","refund_payer":"Refund from","login":"Log in to manage your payments","manage_payments":"Manage Payments","transactions_title":"Your Transactions","transaction_title":"Transaction Receipt","transaction_period":"Plan Period","arrangements_title":"Your Plans","arrangement_title":"Manage Plan","arrangement_details":"Plan Details","arrangement_id_title":"Plan ID","arrangement_payment_method_title":"Payment Method","arrangement_amount_title":"Plan Amount","arrangement_renewal_title":"Next renewal date","arrangement_action_cancel":"Cancel Plan","arrangement_action_cant_cancel":"Cancelling is currently not available.","arrangement_action_cancel_double":"Are you sure you'd like to cancel?","arrangement_cancelling":"Cancelling Plan...","arrangement_cancelled":"Plan Cancelled","arrangement_failed_to_cancel":"Failed to cancel plan","back_to_plans":"\u2190 Back to Plans","update_payment_method_verb":"Update","sca_auth_description":"Your have a pending renewal payment which requires authorization.","sca_auth_verb":"Authorize renewal payment","sca_authing_verb":"Authorizing payment","sca_authed_verb":"Payment successfully authorized!","sca_auth_failed":"Unable to authorize! Please try again.","login_button_text":"Log in","login_form_has_an_error":"Please check and fix the errors above","uppercase_search":"Search","lowercase_search":"search","uppercase_page":"Page","lowercase_page":"page","uppercase_items":"Items","lowercase_items":"items","uppercase_per":"Per","lowercase_per":"per","uppercase_of":"Of","lowercase_of":"of","back":"Back to plans","zip_code_placeholder":"Zip\/Postal Code","download_file_button_text":"Download File","input_field_instructions":{"tip_amount":{"placeholder_text":"How much would you like to tip?","initial":{"instruction_type":"normal","instruction_message":"How much would you like to tip? Choose any currency."},"empty":{"instruction_type":"error","instruction_message":"How much would you like to tip? Choose any currency."},"invalid_curency":{"instruction_type":"error","instruction_message":"Please choose a valid currency."}},"recurring":{"placeholder_text":"Recurring","initial":{"instruction_type":"normal","instruction_message":"How often would you like to give this?"},"success":{"instruction_type":"success","instruction_message":"How often would you like to give this?"},"empty":{"instruction_type":"error","instruction_message":"How often would you like to give this?"}},"name":{"placeholder_text":"Name on Credit Card","initial":{"instruction_type":"normal","instruction_message":"Enter the name on your card."},"success":{"instruction_type":"success","instruction_message":"Enter the name on your card."},"empty":{"instruction_type":"error","instruction_message":"Please enter the name on your card."}},"privacy_policy":{"terms_title":"Terms and conditions","terms_body":null,"terms_show_text":"View Terms","terms_hide_text":"Hide Terms","initial":{"instruction_type":"normal","instruction_message":"I agree to the terms."},"unchecked":{"instruction_type":"error","instruction_message":"Please agree to the terms."},"checked":{"instruction_type":"success","instruction_message":"I agree to the terms."}},"email":{"placeholder_text":"Your email address","initial":{"instruction_type":"normal","instruction_message":"Enter your email address"},"success":{"instruction_type":"success","instruction_message":"Enter your email address"},"blank":{"instruction_type":"error","instruction_message":"Enter your email address"},"not_an_email_address":{"instruction_type":"error","instruction_message":"Make sure you have entered a valid email address"}},"note_with_tip":{"placeholder_text":"Your note here...","initial":{"instruction_type":"normal","instruction_message":"Attach a note to your tip (optional)"},"empty":{"instruction_type":"normal","instruction_message":"Attach a note to your tip (optional)"},"not_empty_initial":{"instruction_type":"normal","instruction_message":"Attach a note to your tip (optional)"},"saving":{"instruction_type":"normal","instruction_message":"Saving note..."},"success":{"instruction_type":"success","instruction_message":"Note successfully saved!"},"error":{"instruction_type":"error","instruction_message":"Unable to save note note at this time. Please try again."}},"email_for_login_code":{"placeholder_text":"Your email address","initial":{"instruction_type":"normal","instruction_message":"Enter your email to log in."},"success":{"instruction_type":"success","instruction_message":"Enter your email to log in."},"blank":{"instruction_type":"error","instruction_message":"Enter your email to log in."},"empty":{"instruction_type":"error","instruction_message":"Enter your email to log in."}},"login_code":{"initial":{"instruction_type":"normal","instruction_message":"Check your email and enter the login code."},"success":{"instruction_type":"success","instruction_message":"Check your email and enter the login code."},"blank":{"instruction_type":"error","instruction_message":"Check your email and enter the login code."},"empty":{"instruction_type":"error","instruction_message":"Check your email and enter the login code."}},"stripe_all_in_one":{"initial":{"instruction_type":"normal","instruction_message":"Enter your credit card details here."},"empty":{"instruction_type":"error","instruction_message":"Enter your credit card details here."},"success":{"instruction_type":"normal","instruction_message":"Enter your credit card details here."},"invalid_number":{"instruction_type":"error","instruction_message":"The card number is not a valid credit card number."},"invalid_expiry_month":{"instruction_type":"error","instruction_message":"The card's expiration month is invalid."},"invalid_expiry_year":{"instruction_type":"error","instruction_message":"The card's expiration year is invalid."},"invalid_cvc":{"instruction_type":"error","instruction_message":"The card's security code is invalid."},"incorrect_number":{"instruction_type":"error","instruction_message":"The card number is incorrect."},"incomplete_number":{"instruction_type":"error","instruction_message":"The card number is incomplete."},"incomplete_cvc":{"instruction_type":"error","instruction_message":"The card's security code is incomplete."},"incomplete_expiry":{"instruction_type":"error","instruction_message":"The card's expiration date is incomplete."},"incomplete_zip":{"instruction_type":"error","instruction_message":"The card's zip code is incomplete."},"expired_card":{"instruction_type":"error","instruction_message":"The card has expired."},"incorrect_cvc":{"instruction_type":"error","instruction_message":"The card's security code is incorrect."},"incorrect_zip":{"instruction_type":"error","instruction_message":"The card's zip code failed validation."},"invalid_expiry_year_past":{"instruction_type":"error","instruction_message":"The card's expiration year is in the past"},"card_declined":{"instruction_type":"error","instruction_message":"The card was declined."},"missing":{"instruction_type":"error","instruction_message":"There is no card on a customer that is being charged."},"processing_error":{"instruction_type":"error","instruction_message":"An error occurred while processing the card."},"invalid_request_error":{"instruction_type":"error","instruction_message":"Unable to process this payment, please try again or use alternative method."},"invalid_sofort_country":{"instruction_type":"error","instruction_message":"The billing country is not accepted by SOFORT. Please try another country."}}}},"fetched_oembed_html":false}
Very neat and crisp article
“Disabling basic authentication for PowerShell forces accounts to use multi-factor authentication when they connect to Exchange Online.”
I know that disabling basic auth forces the use of Exchange Online PowerShell (which is available via EAC/Hybrid, of all places), but is it really the case that that module itself requires MFA? Yes, it’s closely associated with MFA, as supporting MFA was the reason that it was developed, but I thought that Connect-EXOPSSession worked without it.
I think the case is that if you can’t use basic authentication and must use MFA, then Connect-EXOPSSession is the only way to use PowerShell.
That must be it, since the normal way of connecting to Exchange Online in PowerShell seems to be working just fine here on pure basic auth (i.e. no exception for PowerShell). I think MS could have made this a tad clearer, since they said “If you block Basic authentication for Exchange Online PowerShell, you need to use the Exchange Online PowerShell Module to connect.”
Yep. That’s mentioned in https://office365itpros.com/2018/10/24/disable-basic-authentication-exchange-online/
To follow-up on the PowerShell/Exchange comment, I just hadn’t waited long enough. Refreshing the token apparently isn’t foolproof, since being cut off from PowerShell (for Exchange Online) took about a day (“AccessDenied”). So, it is true that pure basic auth forces the use of the new module, Exchange Online PowerShell, but it in turn doesn’t force MFA.
What time did you set for the token refresh when you assigned the policy to mailboxes. If you set it to be the current time, all existing tokens are cancelled and access needs to be reauthenticated immediately.
Yes, it was the same command that you show above, ending in UtcNow. But I ran my usual PowerShell batch many times in the day since then, and it always worked without incident, until this morning. Not a big deal, and it makes MS’s sentence about it exactly right, but my usual all-in-one script will need to be adapted for the new module (there are some lengthy threads around about how to do that). As a standalone, the new module works fine.
Those who did this back in the day might want to run the “Checking Policies Are Applied to Accounts” command above. When I did that again after all these years, I was surprised to find that about half the accounts did not have the (lone) existing policy applied, and this is despite having used the “Defining a Default Protocol Authentication Policy” command back then (it still shows set today).
The accounts in question are all new ones from over the last few years (since implementing the policy). While these accounts are blank in the AuthenticationPolicy column, the StsRefreshTokensValidFrom for a great many of these same ones have 2020 and 2021 dates. I’m not sure what to make of that, but I think the former column holds more weight than the latter, right?
In any case, today I ran the “Assigning Policies to Users” command for the first time since back then, and it all looks good again. But obviously I’ll have to set a reminder for myself to look at this a month or two from now to see what happens with newly created mailboxes. Maybe this was all a hiccup and won’t happen again.
Yes, so new accounts are blank for AuthenticationPolicy despite a StsRefreshTokensValidFrom date. This suggests to me that new users are not included in the default policy, which is not good since it involves manual intervention each time.
Hello quick question, for a customer that has a tenant prior to authentication policies being a thing therefore the tenant had no authentication policy, when creating a new authentication policy and making it the default policy for the organization, is it expected that new users created after the authentication policy being made default is still listed as an authentication policy of “null” ?
I think I answered the same question on the Practical365.com site just now… The answer is that when a user account shows null for the authentication policy, Exchange Online applies the default organization policy (the one managed through the Microsoft 365 admin center). If you want to use a non-default policy, you must assign the policies with Set-User and remember to do this when new accounts are created.
Hello Tony, Thanks for the quick reply! This makes sense now, I created an authentication policy and made it the default policy via PowerShell, and I now see the settings I made to block basic auth are visible in the “Modern Authentication” service in “Org Settings” on the M365 admin center. I was just hung up on the fact new users auth policy was still null, I was expecting to list the policy name (even if its default)
Thanks Again!
Peter, I’m glad you brought this up (I had the same question in July). Since it’s not really practical to continue to revisit this as new users are added (something that I didn’t even know was needed until I happened to notice it in July), and also because no customization is needed here, I just ditched our circa 2018 policy and went with the one that Admin creates automatically (augmented by manually disabling AllowBasicAuthOutlookService and AllowBasicAuthReportingWebServices, since they aren’t otherwise covered), and then applied that to all existing accounts.
As I understand it, that should be the end of this going forward; new accounts, as Tony suggests, will fall under this “default” policy and actually see it applied to them. It’s unclear to me why the original policy (now gone) created via PowerShell, especially since it was the default (and only) policy, wouldn’t have enjoyed the same benefit for new users.