PowerShell을 사용 하 여 사용자로 Azure Stack 허브에 연결Connect to Azure Stack Hub with PowerShell as a user
PowerShell을 사용 하 여 Azure Stack 허브에 연결 하 Azure Stack 허브 리소스를 관리할 수 있습니다.You can connect to Azure Stack Hub with PowerShell to manage Azure Stack Hub resources. 예를 들어 PowerShell을 사용 하 여 제품을 구독 하 고, Vm (가상 머신)을 만들고 Azure Resource Manager 템플릿을 배포할 수 있습니다.For example, you can use PowerShell to subscribe to offers, create virtual machines (VMs), and deploy Azure Resource Manager templates.
설정 하려면 다음을 수행 합니다.To get setup:
- 요구 사항이 있는지 확인 합니다.Make sure you have the requirements.
- Azure Active Directory (Azure AD) 또는 Active Directory Federation Services (AD FS)를 사용 하 여 연결 합니다.Connect with Azure Active Directory (Azure AD) or Active Directory Federation Services (AD FS).
- 리소스 공급자를 등록 합니다.Register resource providers.
- 연결을 테스트합니다.Test your connectivity.
PowerShell을 사용 하 여 연결 하기 위한 필수 구성 요소Prerequisites to connecting with PowerShell
이러한 필수 구성 요소를 개발 키트에서 구성 하거나, VPN을 통해 연결하는 경우 Windows 기반 외부 클라이언트에서 구성 합니다.Configure these prerequisites from the development kit, or from a Windows-based external client if you're connected through VPN:
- Azure Stack 허브 호환 Azure PowerShell 모듈을 설치 합니다.Install Azure Stack Hub-compatible Azure PowerShell modules.
- Azure Stack 허브를 사용 하는 데 필요한 도구를 다운로드 합니다.Download the tools required to work with Azure Stack Hub.
다음 스크립트 변수를 Azure Stack 허브 구성의 값으로 바꾸어야 합니다.Make sure you replace the following script variables with values from your Azure Stack Hub configuration:
- Azure AD 테넌트 이름Azure AD tenant name
Azure Stack 허브를 관리 하는 데 사용 되는 Azure AD 테 넌 트의 이름입니다.The name of your Azure AD tenant used to manage Azure Stack Hub. 예를 들면 yourdirectory.onmicrosoft.com입니다.For example, yourdirectory.onmicrosoft.com. - Azure Resource Manager 끝점Azure Resource Manager endpoint
Azure Stack Development kit의 경우이 값은로 설정 됩니다https://management.local.azurestack.external
.For Azure Stack Development kit, this value is set tohttps://management.local.azurestack.external
. Azure Stack 허브 통합 시스템에 대해이 값을 얻으려면 서비스 공급자에 게 문의 하십시오.To get this value for Azure Stack Hub integrated systems, contact your service provider.
Azure AD를 사용 하 여 Azure Stack 허브에 연결Connect to Azure Stack Hub with Azure AD
Add-AzEnvironment -Name "AzureStackUser" -ArmEndpoint "https://management.local.azurestack.external"
# Set your tenant name
$AuthEndpoint = (Get-AzEnvironment -Name "AzureStackUser").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 Hub cmdlets
# can be easily targeted at your Azure Stack Hub instance.
Connect-AzAccount -EnvironmentName "AzureStackUser" -TenantId $TenantId
AD FS를 사용 하 여 Azure Stack 허브에 연결Connect to Azure Stack Hub with AD FS
# Register an Azure Resource Manager environment that targets your Azure Stack Hub instance
Add-AzEnvironment -Name "AzureStackUser" -ArmEndpoint "https://management.local.azurestack.external"
# Sign in to your environment
Connect-AzAccount -EnvironmentName "AzureStackUser"
리소스 공급자 등록Register resource providers
리소스 공급자는 포털을 통해 배포 된 리소스가 없는 새 사용자 구독에 대해 자동으로 등록 되지 않습니다.Resource providers aren't automatically registered for new user subscriptions that don't have any resources deployed through the portal. 다음 스크립트를 실행 하 여 리소스 공급자를 명시적으로 등록할 수 있습니다.You can explicitly register a resource provider by running the following script:
foreach($s in (Get-AzSubscription)) {
Select-AzSubscription -SubscriptionId $s.SubscriptionId | Out-Null
Write-Progress $($s.SubscriptionId + " : " + $s.SubscriptionName)
Get-AzResourceProvider -ListAvailable | Register-AzResourceProvider
}
참고
AD FS은 사용자 id로 대화형 인증만 지원 합니다.AD FS only supports interactive authentication with user identities. 자격 증명 개체가 필요한 경우 SPN (서비스 사용자)을 사용 해야 합니다.If a credential object is required, you must use a service principal (SPN). Id 관리 서비스로 Azure Stack 허브 및 AD FS를 사용 하 여 서비스 주체를 설정 하는 방법에 대 한 자세한 내용은 AD FS 앱 Id 관리를 참조 하세요.For more information on setting up a service principal with Azure Stack Hub and AD FS as your identity management service, see Manage an AD FS app identity.
연결 테스트Test the connectivity
모든 설정이 끝나면 PowerShell을 사용 하 여 연결을 테스트 하 여 Azure Stack 허브에 리소스를 만듭니다.When you've got everything setup, test connectivity by using PowerShell to create resources in Azure Stack Hub. 테스트로 응용 프로그램에 대 한 리소스 그룹을 만들고 VM을 추가 합니다.As a test, create a resource group for an application and add a VM. 다음 명령을 실행 하 여 "MyResourceGroup" 이라는 리소스 그룹을 만듭니다.Run the following command to create a resource group named "MyResourceGroup":
New-AzResourceGroup -Name "MyResourceGroup" -Location "Local"
다음 단계Next steps
- Azure Stack 허브를 위한 템플릿 개발Develop templates for Azure Stack Hub
- PowerShell을 사용하여 템플릿 배포Deploy templates with PowerShell
- Azure Stack 허브 PowerShell 모듈 참조Azure Stack Hub PowerShell Module Reference
- 클라우드 운영자 환경에 PowerShell을 설정 하려면 Azure Stack 허브 운영자의 powershell 환경 구성 문서를 참조 하세요.If you want to set up PowerShell for the cloud operator environment, refer to the Configure the Azure Stack Hub operator's PowerShell environment article.