New-SCSession issue - can't resolve api.admin.microsoft.com ?

Ron J Bassilian 1 Reputation point
2021-10-26T20:14:54.573+00:00

I want to automate queries into O365 service health and found what the O365ServiceCommunications module for this. The issue is, when I invoke New-SCSession, it returns the error: "Invoke-RestMethod: The remote name could not be resolved: 'api.admin.microsoftonline.com'".
I'm seeing various articles about how to get around this. The best I've seen is the following article that it's been moved to a new Graph API: https://practical365.com/moving-office365-service-communications-api-graph/
Also seeing some articles about dissecting the script and maybe changing the uri in the script, or installing the O265SC module with some -allowprerelease option. But I'm not sure how deeply I want to explore these experimental methods. I was not able to get that -allowprerelease paramter to be recognized.
Is there some kind of established way to connect to this module?

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
11,205 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. MichaelHan-MSFT 18,046 Reputation points
    2021-10-27T02:30:19.917+00:00

    Hi @RonBassilian-2772,

    For the AllowPrerelease issue, you need to install modules with the below command:

    Install-Module -Name PackageManagement -Repository PSGallery -Force  
    Install-Module -Name PowerShellGet -Repository PSGallery -Force  
    

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.