Connect to Azure Stack with PowerShell as an operator
Applies to: Azure Stack integrated systems and Azure Stack Development Kit
You can configure the Azure Stack to use PowerShell to manage resources such as creating offers, plans, quotas, and alerts. This topic helps you configure the operator environment.
- Install Azure Stack-compatible Azure PowerShell modules.
- Download the tools required to work with Azure Stack.
Connect with Azure AD
Configure the Azure Stack operator environment with PowerShell. Run one of the following scripts: Replace the Azure Active Directory (Azure AD) tenantName and Azure Resource Manager endpoint values with your own environment configuration.
# Register an Azure Resource Manager environment that targets your Azure Stack instance. Get your Azure Resource Manager endpoint value from your service provider. Add-AzureRMEnvironment -Name "AzureStackAdmin" -ArmEndpoint "https://adminmanagement.local.azurestack.external" # Set your tenant name $AuthEndpoint = (Get-AzureRmEnvironment -Name "AzureStackAdmin").ActiveDirectoryAuthority.TrimEnd('/') $AADTenantName = "<myDirectoryTenantName>.onmicrosoft.com" $TenantId = (invoke-restmethod "$($AuthEndpoint)/$($AADTenantName)/.well-known/openid-configuration").issuer.TrimEnd('/').Split('/')[-1] # After signing in to your environment, Azure Stack cmdlets # can be easily targeted at your Azure Stack instance. Add-AzureRmAccount -EnvironmentName "AzureStackAdmin" -TenantId $TenantId
Connect with AD FS
Connect to the Azure Stack operator environment with PowerShell with Azure Active Directory Federated Services (Azure AD FS). For Azure Stack development kit, this Azure Resource Manager endpoint is set to
https://adminmanagement.local.azurestack.external. To get the Azure Resource Manager endpoint for Azure Stack integrated systems, contact your service provider.
# Register an Azure Resource Manager environment that targets your Azure Stack instance. Get your Azure Resource Manager endpoint value from your service provider. Add-AzureRMEnvironment -Name "AzureStackAdmin" -ArmEndpoint "https://adminmanagement.local.azurestack.external" # Sign in to your environment Login-AzureRmAccount -EnvironmentName "AzureStackAdmin"
AD FS only supports interactive authentication with user identities. If a credential object is required you must use a service principal (SPN). For more information on setting up a service principal with Azure Stack and AD FS as your identity management service, see Manage service principal for AD FS.
Test the connectivity
Now that you've got everything set-up, use PowerShell to create resources within Azure Stack. For example, you can create a resource group for an application and add a virtual machine. Use the following command to create a resource group named MyResourceGroup.
New-AzureRmResourceGroup -Name "MyResourceGroup" -Location "Local"
We'd love to hear your thoughts. Choose the type you'd like to provide:
Our feedback system is built on GitHub Issues. Read more on our blog.