Microsoft MVP성태의 닷넷 이야기
개발 환경 구성: 293. Azure 구독 후 PaaS 서비스 만들어 보기 [링크 복사], [링크+제목 복사],
조회: 15615
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
 
(연관된 글이 2개 있습니다.)

Azure 구독 후 PaaS 서비스 만들어 보기


일단 Azure 구독을 했으면,

Microsoft Azure 서비스의 구독은 반드시 IE로!
; https://www.sysnet.pe.kr/2/0/11002

이제 IE는 더 이상 필요없습니다. 아무 웹 브라우저나 사용해서 Azure Portal 사이트를 접속하고,

Microsoft Azure Portal
; https://portal.azure.com

azure_paas_1.png

여러분이 원하는 클라우드 서비스를 생성해 주시면 됩니다. 여기서는, 가장 초기부터 제공되었던 PaaS 서비스의 하나인 "클라우드 서비스(클래식)"을 생성해 볼텐데요.

다음과 같이 왼쪽 패널에서 "클라우드 서비스(클래식)"을 선택 후 "추가" 버튼을 눌러줍니다.

azure_paas_2.png

그럼, PaaS 서비스를 대표할 DNS 이름, 구독 정보, 리소스 그룹, 위치를 지정합니다.

azure_paas_3.png

각 필드에 대해 좀 더 설명해 보면 대략 이렇습니다.

  • DNS 이름: Azure가 기본 제공하는 DNS이지만, 원한다면 여러분들의 DNS로 지정할 수 있습니다.
  • 구독: 사용료를 지불할 "구독" 정보를 선택합니다.
  • 리소스 그룹: 최초에는 이전에 생성한 리소스 그룹이 없을 테니 무조건 "새로 만들기"를 합니다. 그 이후에는, 이 리소스 단위로 권한 설정 등의 정책을 적용하게 됩니다.
  • 위치: 현재 한국의 경우 2곳이 예정되어 있지만 아직 없으니 가까운 일본으로 지정하면 됩니다. (자세한 위치 정보: https://azure.microsoft.com/ko-kr/regions/)

이제 "만들기" 버튼을 누르면 "PaaS 서비스" 단위가 하나 만들어지고, "클라우드 서비스(클래식)" 뷰에 다음과 같이 항목이 보입니다.

azure_paas_4.png

이로써 여러분들의 서비스를 담을 컨테이너 설정이 완료됩니다.




컨테이너 설정은 끝났으니, 거기에 담을 컨텐츠를 작성해야 합니다. 간단하게 ASP.NET 웹 사이트를 하나 만들어도 되고, 기존 웹 사이트 프로젝트를 그대로 사용해도 됩니다. (테스트를 위해 빈 사이트라도 ASP.NET 프로젝트를 하나 만들어 줍니다.)

현재의 ASP.NET 프로젝트는 Azure와 아무런 연결 관계가 없는데요. 이 연결을 위해 새 프로젝트 대화창에서 "Cloud" / "Azure Cloud Service" 프로젝트를 현재 솔루션에 추가해 줍니다.

azure_paas_5.png

그럼, 다음과 같이 창이 나오는데,

azure_paas_6.png

만약 여러분들이 "Azure Cloud Service" 프로젝트와 함께 ASP.NET 웹 사이트를 생성하는 거라면 여기서 "ASP.NET Web Role" 항목을 선택해서 추가하면 됩니다. 반면, 이미 생성해 두었던 ASP.NET 사이트에 "Azure Cloud Service" 배포를 할 거라면 이 단계에서 아무것도 안하고 그냥 "OK"를 누릅니다.

여기서는, 이미 만들어 두었던 사이트를 Azure로 배포할 것이므로 "OK"를 누릅니다.

그럼, 프로젝트 구성이 다음과 같이 됩니다.

azure_paas_7.png

사실 "Azure Cloud Service" 프로젝트는 Azure로의 배포를 위한 정보를 가지는 것일 뿐 소스 코드를 포함하지는 않습니다.

이제 기존에 만들어진 ASP.NET 프로젝트(그림에서는 WebApplication1)를 AzureCLoudService1 프로젝트에 알려야 하는데, 이를 위해 "Roles" 노드를 우클릭해,

azure_paas_8.png

"Add" / "Web Role Project in solution..." 메뉴를 선택해 Azure에 배포될 웹 프로젝트를 선택하면 됩니다. 이것을 마치면 다음과 같이 보입니다.

azure_paas_9.png

이제 여러분들의 웹 프로젝트는 Azure 배포를 지원하게 되는데요. 이 때문에 웹 프로젝트를 마우스 우클릭하면 "Publish to Microsoft Azure..." 메뉴가 생깁니다.

azure_paas_10.png

이 메뉴를 선택하면, "Publish Azure Application" 대화창이 뜹니다. 첫 번째는 Azure 구독을 가입한 Microsoft 계정과 구독 이름을 선택하고,

azure_paas_11.png

그다음은, Azure Portal에서 여러분이 생성한 클라우드 서비스 이름을 선택합니다.

azure_paas_12.png

다음의 "Diganostics" 서비스는 원한다면 선택하시고, 여기서는 테스트에 불과하니 그냥 설정을 해제합니다.

azure_paas_13.png

모든 입력을 마치고 "Publish" 버튼을 누르면 이제 Azure 클라우드 서비스로 웹 사이트가 배포됩니다. 이후, 웹 사이트가 변경되면 다시 "Publish to Microsoft Azure..." 메뉴를 선택해 배포를 반복하는 식으로 업데이트를 합니다.

이것으로 여러분들의 첫 번째 PaaS 프로젝트 실습이 완료됩니다. ^^




Azure Cloud Service가 좋은 점이 하나 있다면, 바로 RDP 접속이 된다는 것입니다. 추가된 AzureCloudService1 노드를 마우스 우클릭하면 "Configure Remote Desktop..." 메뉴가 나오는데 이를 선택해 현재 웹 응용 프로그램이 배포된 Virtual Machine으로의 RDP 접속을 '허가'할 수 있습니다. 이렇게 설정된 정보는 AzureCloudService1 프로젝트의 ServiceConfiguration.[Cloud/Local].cscfg 파일에 저장됩니다. (참고로, 계정 명을 email 형식으로 넣으면 로그인이 안됩니다.)

<?xml version="1.0" encoding="utf-8"?>
<ServiceConfiguration serviceName="AzureCloudService1" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="4" osVersion="*" schemaVersion="2015-04.2.6">
  <Role name="WebApplication1">
    <Instances count="1" />
    <ConfigurationSettings>
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.Enabled" value="true" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountUsername" value="...[생략]..." />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountEncryptedPassword" value="MIIBnQYJKoZIhvcNAQcDoIIBj..[생략]...p7wtJreiJSFV0Bde1Cz" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountExpiration" value="2017-07-22T23:59:59.0000000+09:00" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteForwarder.Enabled" value="true" />
    </ConfigurationSettings>
    <Certificates>
      <Certificate name="Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption" thumbprint="2BE3E581411C442389194D457413385756C015F3" thumbprintAlgorithm="sha1" />
    </Certificates>
  </Role>
</ServiceConfiguration>

따라서, 웹 사이트를 다시 (소스 코드 변경에 상관없이) Azure에 배포해야 그다음부터 RDP 접속이 됩니다.

일단 RDP 접속을 허용했으면, 서버 탐색기에서 해당 서비스가 실행 중인 Azure VM 인스턴스를 찾아 마우스 우클릭해 "Connect using Remote Desktop..." 메뉴를 선택해 RDP 접속을 할 수 있습니다.

azure_paas_14.png

그럼, 여느 RDP 연결과 다름없는 VM 접속 환경이 되어 여러분들이 원하는 작업을 할 수 있습니다.




딱 한 번, 다음과 같은 메시지로 배포 시 오류가 발생했던 적이 있습니다.

Unable to update connection strings in the Service Configuration: Cloud
not get the Microsoft Azure storage account settings for '...' needed to configure an application module. Please check your network connection and verify that the account exists.


그냥 잠시 후 다시 배포를 하니 문제 없이 되었습니다.




Azure Cloud Service로 배포되는 WebRole은 현재 지원되는 .NET 버전이 4.0/4.5입니다. 만약 4.6이 포함된 웹 프로젝트를 배포하는 경우 다음과 같은 식의 빌드 경고가 발생합니다. (2017-01-07 업데이트: osFamily를 5로 지정하면 Windows Server 2016 VM이 사용되어 닷넷 4.6이 가능해집니다.)

2>------ Rebuild All started: Project: AzureCloudService1, Configuration: Debug Any CPU ------
2>..\WebApplication1\WebApplication1.csproj(0,0): warning WAT210: Microsoft Azure Cloud Service projects only support roles that run on .NET Framework versions 4.0 and 4.5.  Please set the Target Framework property in the project settings for project 'WebApplication1' to .NET Framework 4.0, or .NET Framework 4.5.
2>WebApplication1(0,0): warning WAT190: The project 'WebApplication1' targets .NET Framework 4.6. To make sure that the role starts, this version of the .NET Framework must be installed on the virtual machine for this role. You can use a startup task to install the required version, if it is not already installed as part of the Microsoft Azure guest OS. For more details, see http://go.microsoft.com/fwlink/?LinkId=309796.

빌드 시 발생하는 경고 메시지라서 무시할 수 있는데요. 절대 무시해서는 안됩니다. 이런 경우 배포 후 응용 프로그램이 구동되지 않습니다.




"Publish to Microsoft Azure..." 메뉴를 선택해서 배포할 때 마법사 창의 "Diagnostics Settings" 단계에서 "Send diagnostics data to Application Insights" 옵션이 언제나 설정되어 있는 것을 볼 수 있습니다. 원치 않는 경우, 매번 배포할때마다 이 옵션을 꺼야 하는데요. 이게 은근히 귀찮습니다.

다행히, 이 단계를 끄는 방법이 있습니다.

disable send diagnostics data to application insights on publish settings
; http://stackoverflow.com/questions/37052111/disable-send-diagnostics-data-to-application-insights-on-publish-settings

다음과 같이 "Azure Cloud Service" 프로젝트의 "Roles"에 등록된 웹 프로젝트를 마우스 우클릭해 "Add Diagnostic Configuration"을 선택하면 하위에 "diagnostics.wadcfgx" 파일이 생성됩니다. (이미 이 파일이 있다면 다음 단계로 넘어갑니다.)

azure_paas_15.png

그다음, 다시 "Roles"에 등록된 웹 프로젝트를 마우스 우클릭해 "Properties" 메뉴를 선택하면 다음 화면과 같이 속성 창이 열리고,

azure_paas_16.png

위의 화면에서 "Send diagnostics data to Application Insights" 옵션을 체크하면 설정 창이 나옵니다.

azure_paas_17.png

보는 바와 같이 "Manually specified Application Insights instrumentation key" 항목을 선택하고 입력 상자에는 무작위로 의미 없는 값을 입력한 후 "OK" 버튼을 누릅니다.

그럼 속성 창에 다음과 같이 구성되는데,

azure_paas_18.png

위에서 무작위로 입력했던 값을 지우고 저장해 줍니다. 이후부터는, "Publish to Microsoft Azure..." 메뉴로 배포 시 "Diagnostics Settings"를 묻지 않으며, "Application Insights instrumentation key" 값도 비어 있기 때문에 아무런 영향을 끼치지 않게 됩니다.




[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]

[연관 글]






[최초 등록일: ]
[최종 수정일: 7/10/2021]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
by SeongTae Jeong, mailto:techsharer at outlook.com

비밀번호

댓글 작성자
 




... 46  47  48  49  50  51  52  53  54  55  56  [57]  58  59  60  ...
NoWriterDateCnt.TitleFile(s)
12208정성태4/12/20209970Linux: 29. 리눅스 환경에서 C/C++ 프로그램이 Segmentation fault 에러가 발생한 경우
12207정성태4/2/20208954스크립트: 19. Windows PowerShell의 NonInteractive 모드
12206정성태4/2/202011253오류 유형: 613. 파일 잠금이 바로 안 풀린다면? - The process cannot access the file '...' because it is being used by another process.
12205정성태4/2/20208642스크립트: 18. Powershell에서는 cmd.exe의 명령어를 지원하진 않습니다.
12204정성태4/1/20208458스크립트: 17. Powershell 명령어에 ';' (semi-colon) 문자가 포함된 경우
12203정성태3/18/202010485오류 유형: 612. warning: 'C:\ProgramData/Git/config' has a dubious owner: '...'.
12202정성태3/18/202013111개발 환경 구성: 486. .NET Framework 프로젝트를 위한 GitLab CI/CD Runner 구성
12201정성태3/18/202010912오류 유형: 611. git-credential-manager.exe: Using credentials for username "Personal Access Token". [1]
12200정성태3/18/202011332VS.NET IDE: 145. NuGet + Github 라이브러리 디버깅 관련 옵션 3가지 - "Enable Just My Code" / "Enable Source Link support" / "Suppress JIT optimization on module load (Managed only)"
12199정성태3/17/20209182오류 유형: 610. C# - CodeDomProvider 사용 시 Unhandled Exception: System.IO.DirectoryNotFoundException: Could not find a part of the path '...\f2_6uod0.tmp'.
12198정성태3/17/202011930오류 유형: 609. SQL 서버 접속 시 "Cannot open user default database. Login failed."
12197정성태3/17/202011076VS.NET IDE: 144. .NET Core 콘솔 응용 프로그램을 배포(publish) 시 docker image 자동 생성 - 두 번째 이야기 [1]
12196정성태3/17/20208998오류 유형: 608. The ServicedComponent being invoked is not correctly configured (Use regsvcs to re-register).
12195정성태3/16/202010715.NET Framework: 902. C# - 프로세스의 모든 핸들을 열람 - 세 번째 이야기
12194정성태3/16/202013033오류 유형: 607. PostgreSQL - Npgsql.NpgsqlException: sorry, too many clients already
12193정성태3/16/20209722개발 환경 구성: 485. docker - SAP Adaptive Server Enterprise 컨테이너 실행 [1]
12192정성태3/14/202012173개발 환경 구성: 484. docker - Sybase Anywhere 16 컨테이너 실행
12191정성태3/14/202012535개발 환경 구성: 483. docker - OracleXE 컨테이너 실행 [1]
12190정성태3/14/20208647오류 유형: 606. Docker Desktop 업그레이드 시 "The process cannot access the file 'C:\Program Files\Docker\Docker\resources\dockerd.exe' because it is being used by another process."
12189정성태3/13/202013492개발 환경 구성: 482. Facebook OAuth 처리 시 상태 정보 전달 방법과 "유효한 OAuth 리디렉션 URI" 설정 규칙
12188정성태3/13/202015802Windows: 169. 부팅 시점에 실행되는 chkdsk 결과를 확인하는 방법
12187정성태3/12/20208469오류 유형: 605. NtpClient was unable to set a manual peer to use as a time source because of duplicate error on '...'.
12186정성태3/12/20209562오류 유형: 604. The SysVol Permissions for one or more GPOs on this domain controller and not in sync with the permissions for the GPOs on the Baseline domain controller.
12185정성태3/11/202010240오류 유형: 603. The browser service was unable to retrieve a list of servers from the browser master...
12184정성태3/11/202011646오류 유형: 602. Automatic certificate enrollment for local system failed (0x800706ba) The RPC server is unavailable. [3]
12183정성태3/11/202010012오류 유형: 601. Warning: DsGetDcName returned information for \\[...], when we were trying to reach [...].
... 46  47  48  49  50  51  52  53  54  55  56  [57]  58  59  60  ...