Quantcast
Channel: normalian blog
Viewing all 237 articles
Browse latest View live

Configuration tips when you need to upgrade Service Fabric cluster applications

$
0
0

Service Fabric is one of components to offer Microservice architecture and it's also used with CI/CD tools such like VSTS. In this post, you can learn tips to construct Microservice architecture CI/CD pipeline.

Error #1 "You must first remove the existing application before a new application can be deployed or provide a new name for the application."

You will get this error when you try to upgrade your Service Fabric applications as latest version. Here is error message within VSTS release process.

2018-07-24T23:02:08.4239940Z Imported cluster client certificate with thumbprint 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'.
2018-07-24T23:02:27.2235680Z Successfully connected to cluster.
2018-07-24T23:02:27.2624467Z Searching for path: D:\a\r1\a
2018-07-24T23:02:27.3693528Z No items were found with search pattern D:\a\r1\a.
2018-07-24T23:02:35.2334317Z ##[error]An application with name 'fabric:/MySFASPAppType' already exists, its type is 'MySFASPAppType' and version is '1.0.0.20180724.1'. You must first remove the existing application before a new application can be deployed or provide a new name for the application.
2018-07-24T23:02:35.8774898Z ##[section]Finishing: Deploy Service Fabric Application

You need to configure upgrade option for Service Fabric cluster with Visual Studio like below. You can come up this dialog by right click and choose "Publish".
f:id:waritohutsu:20180725161131p:plain

The configuration will be reflected into "your Service Fabric project name"\PublishProfiles\Cloud.xml like below.

<?xml version="1.0" encoding="utf-8"?><PublishProfile xmlns="http://schemas.microsoft.com/2015/05/fabrictools"><ClusterConnectionParameters ConnectionEndpoint="" /><ApplicationParameterFile Path="..\ApplicationParameters\Cloud.xml" /><CopyPackageParameters CompressPackage="true" /><UpgradeDeployment Mode="UnmonitoredAuto"Enabled="true"><Parameters UpgradeReplicaSetCheckTimeoutSec="1"Force="True" /></UpgradeDeployment></PublishProfile>

Confirm "UpgradeDeployment" tag including its child tags. This should solve the error.

Error #2 "The content in ConfigPackage Name:Config and Version:x.x.x in Service Manifest 'xxxxxxxxxxxxxxx' has changed, but the version number is the same."

You should look over - Start-ServiceFabricApplicationUpgrade (ServiceFabric) | Microsoft Docs before proceeding this post. Service Fabric applications have several versions such like Service Fabric package itself, code and config. You need to update some of the versions to upgrade Service Fabric applications.
A temporary solution is to use "Build.BuildId" for the versions. Edit ApplicationManifest.xml and ServiceManifest.xml in your Service Fabric project like below.

"your Service Fabric project name"\ApplicationPackageRoot\ApplicationManifest.xml

<?xml version="1.0" encoding="utf-8"?><ApplicationManifest ApplicationTypeName="SFwithASPNetAppType"ApplicationTypeVersion="1.0.#{Build.BuildId}#"xmlns="http://schemas.microsoft.com/2011/01/fabric"xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><Parameters><Parameter Name="GuestContainer1_InstanceCount"DefaultValue="-1" /></Parameters><!-- Import the ServiceManifest from the ServicePackage. The ServiceManifestName and ServiceManifestVersion        should match the Name and Version attributes of the ServiceManifest element defined in the        ServiceManifest.xml file. --><ServiceManifestImport><ServiceManifestRef ServiceManifestName="GuestContainer1Pkg"ServiceManifestVersion="1.0.#{Build.BuildId}#" /><ConfigOverrides /><Policies><ContainerHostPolicies CodePackageRef="Code"Isolation="hyperv">
    ...

"your Service Fabric project name"\ApplicationPackageRoot\"ServiceManifestName"\ServiceManifest.xml

<?xml version="1.0" encoding="utf-8"?><ServiceManifest Name="GuestContainer1Pkg"Version="1.0.#{Build.BuildId}#"xmlns="http://schemas.microsoft.com/2011/01/fabric"xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><ServiceTypes><!-- This is the name of your ServiceType.         The UseImplicitHost attribute indicates this is a guest service. --><StatelessServiceType ServiceTypeName="GuestContainer1Type"UseImplicitHost="true" /></ServiceTypes><!-- Code package is your service executable. --><CodePackage Name="Code"Version="1.0.#{Build.BuildId}#"><EntryPoint><ContainerHost><ImageName>"my container registry account ".azurecr.io/#{Build.Repository.Name}#:#{Build.BuildId}#</ImageName></ContainerHost></EntryPoint><EnvironmentVariables><EnvironmentVariable Name="VariableName"Value="VariableValue"/></EnvironmentVariables></CodePackage><ConfigPackage Name="Config"Version="1.0.#{Build.BuildId}#" /><Resources><Endpoints><Endpoint Name="GuestContainer1TypeEndpoint"UriScheme="http"Port="xxxx"Protocol="http" /></Endpoints></Resources></ServiceManifest>

You also need to follow Replace configuration files with environment variables on VSTS tasks - normalian blog to replace #{Build.BuildId}# in your xml files.


How to dig into API Management performance with Application Insights

$
0
0

As you know, Azure API Management is integrated with API management like below.
docs.microsoft.com
This article describe how to setup the integration and utilize the feature.

Create your Application Insights

You need to create Application Insights to associate with API management like below. Note you need to choose "General" as Application Type.
f:id:waritohutsu:20180726041037p:plain

Associate your Application Insights with API Management and configure it

Choose "Application Insight" item from left side menus of API Management and associate it like below.
f:id:waritohutsu:20180726041210p:plain

Next, choose "APIs" item from left side menus of API Management and click "Settings" tab. Change "Sampling" and "First bytes of body(max 1024)" after enabling Application Insights like below.
f:id:waritohutsu:20180726041520p:plain
Change "Sampling"value as 100 to pick up all request into Application Insight. And change "First bytes of body(max 1024)" as 1024 or your demand if you need to confirm request body.

How to confirm in Application Insights

At first, you can use "Live Metrics Stream". This shows Request duration, CPU usage, committed memory and others like below.
f:id:waritohutsu:20180726042009p:plain

Second, you can dig into from "performance" tab like below. You can confirm who many requests, how request duration and others. And you can also dig into requests to confirm their dependencies.
f:id:waritohutsu:20180726042125p:plain
f:id:waritohutsu:20180726042134p:plain

How to setup to monitor container apps on Service Fabric clusters with Log Analytics

$
0
0

You can learn how to setup Log Analytics for your Windows container apps on Service Fabric clusters. You need to follow steps below.

  • Setup up Service Fabric cluster with Diagnostics "On"
  • Create an Log Analytics workspace and add "Service Fabric Analytics" into your Log Analytics workspace
  • Add "Container Monitoring Solution" into your Log Analytics workspace
  • Enable "Windows Performance Counters" in your Log Analytics workspace
  • Configure a Log Analytics workspace to associate Azure Storage stored Service Fabric logs
  • Add the OMS agent extension
  • Watch metrics on Log Analytics workspace

According to an article below, you have to setup "Service Fabric Analytics" and "Container Monitoring Solution" respectively right now. It will be integrated in future.

Setup up Service Fabric cluster with Diagnostics "On"

Refer to an article below.
normalian.hatenablog.com
And keep in mind that you should enable "Diagnostics" as "On" like below.
f:id:waritohutsu:20180802120914p:plain

Create an Log Analytics workspace and add "Service Fabric Analytics" into your Log Analytics workspace

It's needed to monitor Service Fabric container apps by creating "Service Fabric Analytics". Search "service fabric" in Marketpalce on Azure Portal like below.
f:id:waritohutsu:20180802120931p:plain
And create Log Analytics workspace and "Service Fabric Analytics" like below.
f:id:waritohutsu:20180802120948p:plain

Add "Container Monitoring Solution" into your Log Analytics workspace

Search "Container Monitor" in Marketpalce on Azure Portal and find "Container Monitoring Solution" like below.
f:id:waritohutsu:20180802121755p:plain
Create "Container Monitoring Solution" into your Log Analytics workspace.

Enable "Windows Performance Counters" in your Log Analytics workspace

After completion to create Log Analytics workspace, go to "Advanced setting -> Data ->Windows Performance Counters" and enable like below.
f:id:waritohutsu:20180802120959p:plain
Don't forget to click "Save" after changing settings of your workspace.

Configure a Log Analytics workspace to associate Azure Storage stored Service Fabric logs

Refer to Assess Service Fabric applications with Azure Log Analytics using PowerShell | Microsoft Docs and execute "Configure Log Analytics to collect and view Service Fabric logs
"PowerShell scripts interactively.
You can find two Azure Storage accounts in your Log Analytics workspace like below.
f:id:waritohutsu:20180802121529p:plain

Add the OMS agent extension

At first, go to your Log Analytics workspace, choose "Advanced settings -> Connected Sources ->Windows Servers" and pick up “WORKSPACE ID” and “PRIMARY KEY” like below.
f:id:waritohutsu:20180802122345p:plain
After that, execute Azure-cli comand below to add oms agent into your VMSS of Service Fabric cluster.

az vmss extension set --name MicrosoftMonitoringAgent --publisher Microsoft.EnterpriseCloud.Monitoring --resource-group <nameOfResourceGroup> --vmss-name <nameOfNodeType> --settings "{'workspaceId':'<Log AnalyticsworkspaceId>'}" --protected-settings "{'workspaceKey':'<Log AnalyticsworkspaceKey>'}"

You can confirm to find three extensions by executing PowerShell commands like below.

PS C:\Users\warit> $resourceGroupName = "your resource group name"
PS C:\Users\warit> $resourceName ="your node type name and it equals to your VMSS name"
PS C:\Users\warit> $virtualMachineScaleSet = Get-AzureRmVmss -ResourceGroupName $resourceGroupName -VMScaleSetName $resourceName
PS C:\Users\warit> $virtualMachineScaleSet.VirtualMachineProfile.ExtensionProfile.Extensions

Name                    : nodetype_ServiceFabricNode
ForceUpdateTag          : 
Publisher               : Microsoft.Azure.ServiceFabric
Type                    : ServiceFabricNode
TypeHandlerVersion      : 1.0
AutoUpgradeMinorVersion : True
Settings                : {clusterEndpoint, nodeTypeRef, dataPath, durabilityLevel...}
ProtectedSettings       : 
ProvisioningState       : 
Id                      : 

Name                    : VMDiagnosticsVmExt_vmNodeType0Name
ForceUpdateTag          : 
Publisher               : Microsoft.Azure.Diagnostics
Type                    : IaaSDiagnostics
TypeHandlerVersion      : 1.5
AutoUpgradeMinorVersion : True
Settings                : {WadCfg, StorageAccount}
ProtectedSettings       : 
ProvisioningState       : 
Id                      : 

Name                    : MicrosoftMonitoringAgent
ForceUpdateTag          : 
Publisher               : Microsoft.EnterpriseCloud.Monitoring
Type                    : MicrosoftMonitoringAgent
TypeHandlerVersion      : 1.0
AutoUpgradeMinorVersion : True
Settings                : {workspaceId}
ProtectedSettings       : 
ProvisioningState       : 
Id                      : 

Watch metrics on Log Analytics workspace

You should wait about 10 minutes or later to store metrics into your Log Analytics workspace. Go to "workspace summary" on your Log Analytics workspace and you can find two items like below.
f:id:waritohutsu:20180802124054p:plain
Choose "Service Fabric" and you can find CPU/Memory/Disk usage both host nodes and container metrics like below.
f:id:waritohutsu:20180802124216p:plain

How to utilize monitoring for container apps on Service Fabric clusters with Log Analytics - part 1: setup

$
0
0

You can learn how to setup Log Analytics for your Windows container apps on Service Fabric clusters. You need to follow steps below.

  • Setup up Service Fabric cluster with Diagnostics "On"
  • Create an Log Analytics workspace and add "Service Fabric Analytics" into your Log Analytics workspace
  • Add "Container Monitoring Solution" into your Log Analytics workspace
  • Enable "Windows Performance Counters" in your Log Analytics workspace
  • Configure a Log Analytics workspace to associate Azure Storage stored Service Fabric logs
  • Add the OMS agent extension
  • Watch metrics on Log Analytics workspace

According to an article below, you have to setup "Service Fabric Analytics" and "Container Monitoring Solution" respectively right now. It will be integrated in future.

Setup up Service Fabric cluster with Diagnostics "On"

Refer to an article below.
normalian.hatenablog.com
And keep in mind that you should enable "Diagnostics" as "On" like below.
f:id:waritohutsu:20180802120914p:plain

Create an Log Analytics workspace and add "Service Fabric Analytics" into your Log Analytics workspace

It's needed to monitor Service Fabric container apps by creating "Service Fabric Analytics". Search "service fabric" in Marketpalce on Azure Portal like below.
f:id:waritohutsu:20180802120931p:plain
And create Log Analytics workspace and "Service Fabric Analytics" like below.
f:id:waritohutsu:20180802120948p:plain

Add "Container Monitoring Solution" into your Log Analytics workspace

Search "Container Monitor" in Marketpalce on Azure Portal and find "Container Monitoring Solution" like below.
f:id:waritohutsu:20180802121755p:plain
Create "Container Monitoring Solution" into your Log Analytics workspace.

Enable "Windows Performance Counters" in your Log Analytics workspace

After completion to create Log Analytics workspace, go to "Advanced setting -> Data ->Windows Performance Counters" and enable like below.
f:id:waritohutsu:20180802120959p:plain
Don't forget to click "Save" after changing settings of your workspace.

Configure a Log Analytics workspace to associate Azure Storage stored Service Fabric logs

Refer to Assess Service Fabric applications with Azure Log Analytics using PowerShell | Microsoft Docs and execute "Configure Log Analytics to collect and view Service Fabric logs
"PowerShell scripts interactively.
You can find two Azure Storage accounts in your Log Analytics workspace like below.
f:id:waritohutsu:20180802121529p:plain

Add the OMS agent extension

At first, go to your Log Analytics workspace, choose "Advanced settings -> Connected Sources ->Windows Servers" and pick up “WORKSPACE ID” and “PRIMARY KEY” like below.
f:id:waritohutsu:20180802122345p:plain
After that, execute Azure-cli comand below to add oms agent into your VMSS of Service Fabric cluster.

az vmss extension set --name MicrosoftMonitoringAgent --publisher Microsoft.EnterpriseCloud.Monitoring --resource-group <nameOfResourceGroup> --vmss-name <nameOfNodeType> --settings "{'workspaceId':'<Log AnalyticsworkspaceId>'}" --protected-settings "{'workspaceKey':'<Log AnalyticsworkspaceKey>'}"

You can confirm to find three extensions by executing PowerShell commands like below.

PS C:\Users\warit> $resourceGroupName = "your resource group name"
PS C:\Users\warit> $resourceName ="your node type name and it equals to your VMSS name"
PS C:\Users\warit> $virtualMachineScaleSet = Get-AzureRmVmss -ResourceGroupName $resourceGroupName -VMScaleSetName $resourceName
PS C:\Users\warit> $virtualMachineScaleSet.VirtualMachineProfile.ExtensionProfile.Extensions

Name                    : nodetype_ServiceFabricNode
ForceUpdateTag          : 
Publisher               : Microsoft.Azure.ServiceFabric
Type                    : ServiceFabricNode
TypeHandlerVersion      : 1.0
AutoUpgradeMinorVersion : True
Settings                : {clusterEndpoint, nodeTypeRef, dataPath, durabilityLevel...}
ProtectedSettings       : 
ProvisioningState       : 
Id                      : 

Name                    : VMDiagnosticsVmExt_vmNodeType0Name
ForceUpdateTag          : 
Publisher               : Microsoft.Azure.Diagnostics
Type                    : IaaSDiagnostics
TypeHandlerVersion      : 1.5
AutoUpgradeMinorVersion : True
Settings                : {WadCfg, StorageAccount}
ProtectedSettings       : 
ProvisioningState       : 
Id                      : 

Name                    : MicrosoftMonitoringAgent
ForceUpdateTag          : 
Publisher               : Microsoft.EnterpriseCloud.Monitoring
Type                    : MicrosoftMonitoringAgent
TypeHandlerVersion      : 1.0
AutoUpgradeMinorVersion : True
Settings                : {workspaceId}
ProtectedSettings       : 
ProvisioningState       : 
Id                      : 

Watch metrics on Log Analytics workspace

You should wait about 10 minutes or later to store metrics into your Log Analytics workspace. Go to "workspace summary" on your Log Analytics workspace and you can find two items like below.
f:id:waritohutsu:20180802124054p:plain
Choose "Service Fabric" and you can find CPU/Memory/Disk usage both host nodes and container metrics like below.
f:id:waritohutsu:20180802124216p:plain

How to utilize monitoring for container apps on Service Fabric clusters with Log Analytics - part 2: log types

$
0
0

Refer to an article below before following this post to setup Log Analytics for Service Fabric clusters.
normalian.hatenablog.com
You can learn how to execute simple queries on Log Analytics to retrieve Service Fabric clusters metrics.

I believe you have already setup your Service Fabric cluster with your container apps and Log Analytics. Open your Log Analytics and choose "Log Search" item. Next, execute "search *" command like below then you can take all types of logs stored into your Log Analytics.
f:id:waritohutsu:20180809081445p:plain

You can find several types of logs such like "Perf", "ContainerImageInventory", "ContainerInventory", "Heartbeat" and "Usage". According to Container Monitoring solution in Azure Log Analytics | Microsoft Docs, we can understand which metrics we can take. Next, let's dig into each log types exept for Usage, because the type is used for Log Analytics usage.

"Perf" type

In this type, you can retrieve Processor Time, Memory Usage, network usage, Disk usage including container applications.
At first, you retrieve Service Fabric cluster nodes metrics specifying ObjectName as necessary metrics like below.

search *| where Type == "Perf“
| where ObjectName == "Processor“
| where CounterName == "% Processor Time“
| where CounterValue > 25

You can find query result like below.
f:id:waritohutsu:20180809083123p:plain

next, retrieve container apps metrics on Service Fabric cluster by executing log search query below and you can retrieve container apps metrics.

search *
| where Type == "Perf“
| where ObjectName == "Container“
| where CounterName == "% Processor Time“
| where CounterValue > 2

Note the query is specified "Container“ as ObjectName and CounterName which metrics is needed.
f:id:waritohutsu:20180809083246p:plain

We can really dig into this log type in lots of perspectives. I will follow that in future.

"ContainerImageInventory" type

You can retrieve which repositories, images, tags, image sizes and nodes are used to deploy your container apps like below.
f:id:waritohutsu:20180809084040p:plain

"ContainerInventory" type

In this type, you can retrieve TimeGenerated, Computer, container name, ContainerHostname, Image, ImageTag, ContainerState, ExitCode, EnvironmentVar, Command, CreatedTime, StartedTime, FinishedTime, SourceSystem, ContainerID, and ImageID like below.
f:id:waritohutsu:20180809084656p:plain

You can monitor container apps life cycle using this log type using ContainerState, TimeGenerated, CreatedTime, StartedTime and FinishedTime like below.
f:id:waritohutsu:20180809084903p:plain

How to utilize monitoring for container apps on Service Fabric clusters with Log Analytics - part 3: find CPU usage spikes

$
0
0

You can learn how to CPU usage spikesfrom your Log Analytics, but you need to peruse an article below to follow this post.
normalian.hatenablog.com

Prerequirement

You need to setup components below. In this post, we execute performance test to your Service Fabric cluster applications using by Application Insights.

  • Service Fabric cluster with Windows nodes
  • Log Analytics and associate to your Service Fabric cluster
  • Windows Container applications and deploy it into your Service Fabric cluster
  • Application Insights

Execute "Performance Testing" with your Application Insights

I believe as you know, Application Insights offers "Performance Testing" feature. We are no longer needed to setup multiple devices and load test applications such like JMeter.
Open your Application Insights, choose "Performance Testing" item among left side menus and click "New" item to create new performance test.
f:id:waritohutsu:20180811034948p:plain

Input an endpoint of your Service Fabric application following a picture below. Now, you can execute your performance test.
f:id:waritohutsu:20180811035207p:plain

Refer to Test your Azure web app performance under load from the Azure portal | Microsoft Docs how to setup your performance test in details.

Clarify bottlenecks of your Service Fabric applications

Watch your Log Analytics solution to confirm your Service Fabric cluster metrics in about an hour after your performance test. You probably confirm CPU usage spike on your NODE METRICS like below.
f:id:waritohutsu:20180811040548p:plain

Next, execute a query below to identify know exact time of the CPU usage spikes of NODE METRICS not container applications.

search *
| where Type == "Perf"
| where ObjectName == "Processor"
| where CounterName == "% Processor Time"
| where CounterValue > 50
| sort by TimeGenerated

f:id:waritohutsu:20180811041017p:plain

The spikes are around 8/9/2018 6:30PM in PST time zone, but you need to retrieve Log Analytics data with UTC time zone in your query even display time zone is yours. Execute query like below to retrieve all metrics around the time.

search *
| where Type == "Perf"
| where TimeGenerated >datetime(2018-08-10 1:28:00) 
| where TimeGenerated < datetime(2018-08-10 1:31:00)
| sort by TimeGenerated 

f:id:waritohutsu:20180811042635p:plain

And you can download result of the query and analyze it with Excel and other client side tools. At this time, we can find "Processor Queue Lengh" are high like below.
f:id:waritohutsu:20180811050315p:plain

You can dig into further more to use this awesome tools if you will face some performance issues.

How to get started with EA Portal for Microsoft Azure

$
0
0

I believemost of Azure developers aren't familiar with EA Portal because only Enterprise Agreement contractor can utilize the portal. usage of this EA Portal is completely different from Azure Portal which all Azure developers are familiar like below.
f:id:waritohutsu:20190523093843p:plain

  • EA Portal is utilized to create Azure subscriptions which charge from your EA contract
  • Azure Portal is utilized to create Azure resources and consume from EA contract

As you can imagine, billing owners should use EA Portal and developers should use Azure Portal. But it sometimes difficult how to take knowledge to utilize EA Portal.

How to arrange onboarding meeting for EA Portal

Fortunately, Microsoft offers to arrange onboarding meeting with expert for EA Portal. Reach out Azure EA Portal Support and you can find a page like below.
f:id:waritohutsu:20190523094911p:plain
You can find "issue category" bottom of it. Choose "Onboarding" like below to schedule EA Portal onboarding meeting with the expert.
f:id:waritohutsu:20190523095013p:plain
After choosing them, you need to fill out some details of your status. Now, you can have a great meeting to earn deep knowledge for EA Portal. This onboarding meeting is no charge and I recommend to utilize this as possible.

What's the difference between Enterprise Administrator, Department Administrator and Account Owner on EA Portal

$
0
0

I believe you should confuse how to create new Azure subscriptions just after login into EA Portal. As I have illustrated in How to get started with EA Portal for Microsoft Azure, EA Portal has some types of roles named Enterprise Administrator, Department Administrator, and Account Owner. You need to utilize these roles properly to manage your billing and subscriptions on EA Portal.

What's can do by each role?

Here is rough description for each roles, but note that Enterprise Administrator can achieve almost everything except for creating new subscriptions and only Account Owner can do that.

  • Enterprise Administrator
    • Change EA Portal settings
    • Invite new Enterprise Administrators
    • Create new departments
    • Invite new department administrators into all departments
    • Retrieve all departments
    • Retrieve all Account Owners
    • Invite new Account Owners
    • Retrieve all subscriptions
    • Can't create new subscriptions
  • Department Administrator
    • This account is optional
    • Invite new department administrators into own department
    • Retrieve own department
    • Retrieve all Account Owners in own department
    • Invite new Account Owners into own department
    • Retrieve all subscriptions on own department
    • Can't create new subscriptions
  • Account Owner
    • Create new subscriptions

How to invite as Enterprise Administrator

Only current Enterprise Administrator can achieve these operations. Open https://ea.azure.com and following an image below.
f:id:waritohutsu:20190524102435p:plain
A wizard will come up from right side and you can invite new Enterprise Administrator by following an image below. Please confirm "Auth Leve" if you can't find your proper Authentication Type on your EA Portal.
f:id:waritohutsu:20190524102611p:plain
New Enterprise Administrator will receive an invitation mail from your EA Portal and activate own account.

How to invite as Department Administrator

Enterprise Administrator and Department Administrator can achieve these operations. Open https://ea.azure.com and following an image below.
f:id:waritohutsu:20190524103314p:plain
These steps are almost the same with Enterprise Administrator. A wizard will come up from right side and you can invite a new Department Administrator by following an image below. Please confirm "Auth Leve" if you can't find your proper Authentication Type on your EA Portal.
f:id:waritohutsu:20190524103422p:plain

How to invite as Account Owner

Enterprise Administrator and Department Administrator can achieve these operations. Open https://ea.azure.com and following an image below.
f:id:waritohutsu:20190524104727p:plain
These steps are almost the same with Enterprise Administrator. A wizard will come up from right side and you can invite a new Department Administrator by following an image below. Please confirm "Auth Leve" if you can't find your proper Authentication Type on your EA Portal. In addtion that, you can put display name for your EA Portal.
f:id:waritohutsu:20190524104741p:plain
You can find your new Account Owner like below at pending status. It will be activated when the invited user of "Account Owner" will log in to your EA Portal.
f:id:waritohutsu:20190524104652p:plain

What's best practice for these EA Portal hierarchies?

In small organizations, it should work by utilizing only Enterprise Administrator and Account Owner. In addition that, you can hold such roles into a user account like below.
f:id:waritohutsu:20190524105436p:plain
In this diagram, xxxx01@hotmail.com can do everything on your EA Portal. You can create such accounts by following "How to invite as Enterprise Administrator" and "How to invite as Account Owner" into the same account, but consider and design proper architecture when your organization is large or users are many.


Why you can't find your new subscriptions on Azure Portal even you have already created them on EA Portal?

$
0
0

You always need to create new Azure subscriptions on EA Portal if you have own EA contract to utilize Microsoft Azure. I have already posted an article how to get started with EA Portal like below.
normalian.hatenablog.com

It's mandatory to create your Azure subscriptions on EA Portal to charge from your monetary commitment of your EA contract. Refer to an article below which roles on EA Portal can create new Azure subscriptions.
normalian.hatenablog.com

But some folks can't find new Azure subscriptions on Azure Portal. Confirm topics below if you can't find new your subscriptions on Azure Portal.

  • Enable check of Global subscription filter for your new Azure subscription
  • Change Azure AD tenant associated with your new Azure subscription

How to create new subscriptions on EA Portal

Before describing the topics, you need to learn again how to create new subscriptions on EA Portal. Note that it's mandatory to have Account Owner role into your account like below.
f:id:waritohutsu:20190526034140p:plain
You can lunch new tab from EA Portal to create new subscription by clicking "Add Subscription" button and redirect into new page like below. Choose "Microsoft Azure Enterprise" to charge from your EA contract.
f:id:waritohutsu:20190526034222p:plain
Check two agreement terms and click "Sign up" to complete new Azure subscription.
f:id:waritohutsu:20190526034340p:plain
You will be redirected into Azure Portal like below after finishing to create the subscription but you might be not possible to find new subscription like below.
f:id:waritohutsu:20190526034517p:plain

Enable check of Global subscription filter for your new Azure subscription

Azure Portal offers "Global subscription filter" to make visible only selected subscriptions, but the new subscriptions are unchecked to visible as default.
Enable the new subscription on Global subscription filter by following like below.
f:id:waritohutsu:20190526035039p:plain

Change Azure AD tenant associated with your new Azure subscription

I believe as you know, all Azure subscriptions are associated into an Azure Active Directory tenant and have one or more subscription owners like below. In addition that, we can't list subscriptions across Azure Active Directory tenants. f:id:waritohutsu:20190526035811p:plain
This should be the cause why you can't find new Azure subscriptions even you have already enabled Global subscription filter.

New Azure subscriptions should be associated into an Azure Active Directory tenant which has your School or Work Account. It depends situations if your account is Microsoft Account. Refer to an article below if you are unfamiliar with School or Work Account and Microsoft Account.
docs.microsoft.com

Go to the new Azure subscription and choose "Change directory" like below.
f:id:waritohutsu:20190526040724p:plain

Note you need to contact Azure Active Directory tenant administrator not EA Portal administrator if you can't move the subscription into proper Azure Active Directory tenant.

How to get started with Reporting APIs for Enterprise customers of EA Portal

$
0
0

I believe some folks are familiar with Billing API for Microsoft Azure and these APIs can be utilized even you're pay-as-you-go customers. But almost of all folks are unfamiliar with "Reporting APIs for Enterprise customers", because only customers who have EA contract can utilize this APIs.
docs.microsoft.com

I recommend to refer to Azure Billing Enterprise APIs | Microsoft Docs, but here is summary what you can do with the APIs

  • Balance and Summary API - offers a monthly summary of information on balances, new purchases, Azure Marketplace service charges, adjustments and overage charges.
  • Usage Detail API- offers a daily breakdown of consumed quantities and estimated charges by an Enrollment. The result also includes information on instances, meters and departments. The API can be queried by Billing period or by a specified start and end date.
  • Marketplace Store Charge API - returns the usage-based marketplace charges breakdown by day for the specified Billing Period or start and end dates (one time fees are not included).
  • Price Sheet API - provides the applicable rate for each Meter for the given Enrollment and Billing Period.
  • Reserved Instance usage API - returns the usage of the Reserved Instance purchases. The Reserved Instance charges API shows the billing transactions made.

Preparation to use the APIs

You can utilize the APIs to pick up two items below.

It's easy to pick up "Enrollment Number". You just need to visit EA Portal and pick up Enrollment Number like below.
f:id:waritohutsu:20190527084046p:plain

Next, follow an image below and you can generate new APIAccess Key.
f:id:waritohutsu:20190527084142p:plain

After generating of the key, you can copy the key into your clip board.
f:id:waritohutsu:20190527084644p:plain

Balance and Summary API

You can call this API easily by using script below.

$AuthorizationKey = "your API Access Key"
$enrollmentNumber = "your enrollment number"

$res = Invoke-WebRequest `
  -Headers @{"Authorization" = "bearer $AuthorizationKey"} -Method GET `
  -Uri https://consumption.azure.com/v2/enrollments/$enrollmentNumber/balancesummary `
  -ContentType "application/json"

# confirm entire response
$res

## confirm response contents
$res.Content | ConvertFrom-Json

You can confirm the response values of "$res" like below. This structure is even similar with other APIs.

StatusCode        : 200
StatusDescription : OK
Content           : {"id":"enrollments/your enrollment number/billingperiods/your billing periods/balancesummaries","billingPeriodId":"your billing periods","currencyCode":"JPY  
                    ","beginningBalance":xxxxx92.00,"endingBalance":xxxxx85.00,"newPurchases":0.00,"adju...
RawContent        : HTTP/1.1 200 OK
                    session-id: a03789eb-9b3d-49dd-8b12-c2dddb07dd62
                    x-ms-request-id: ade0cb92-3a78-4e2f-943f-b5a9bd4d8320
                    x-ms-correlation-request-id: f570130b-21b1-4bef-b1ff-d9e8a8e80e8b
                    x-ms-client...
Forms             : {}
Headers           : {[session-id, a03789eb-9b3d-49dd-8b12-c2dddb07dd62], [x-ms-request-id, ade0cb92-3a78-4e2f-943f-b5a9bd4d8320], [x-ms-correlation-request-id, 
                    f570130b-21b1-4bef-b1ff-d9e8a8e80e8b], [x-ms-client-request-id, c9d7de6c-8937-48b5-a137-3f026d637cc5]...}
Images            : {}
InputFields       : {}
Links             : {}
ParsedHtml        : mshtml.HTMLDocumentClass
RawContentLength  : 429

You can confirm the response content values of "$res.Content" like below.

id                             : enrollments/"your enrollment number"/billingperiods/"your billing periods"/balancesummaries
billingPeriodId                :  "your billing periods"
currencyCode                   : JPY  
beginningBalance               : xxxxx92.00
endingBalance                  : xxxxx85.00
newPurchases                   : 0.00
adjustments                    : 0.00
utilized                       : xxxxx7.00
serviceOverage                 : 0.00
chargesBilledSeparately        : 0.00
totalOverage                   : 0.00
totalUsage                     : xxxxx7.00
azureMarketplaceServiceCharges : 0.0000000000
newPurchasesDetails            : 
adjustmentDetails              : 

Reserved Instance usage API

You can call this API like below.

$AuthorizationKey = "your API Access Key"
$enrollmentNumber = "your enrollment number"
$startDate = "2019-05-01"
$endDate = "2019-05-10"

$res = Invoke-WebRequest `
  -Headers @{"Authorization" = "bearer $AuthorizationKey"} -Method GET `
  -Uri "https://consumption.azure.com/v2/enrollments/$enrollmentNumber/reservationdetails?startDate=$startDate&endDate=$endDate" `
  -ContentType "application/json"
$res.Content | ConvertFrom-Json

You can confirm the response content values of "$res.Content" like below.

....

reservationOrderId    : xxxxxxxx-mmmm-yyyy-nnnn-zzzzzzzzzzzz
reservationId         : xxxxxxxx-mmmm-yyyy-nnnn-zzzzzzzzzzzz
usageDate             : 2019-05-04T00:00:00
skuName               : Standard_DS1_v2
instanceId            : /subscriptions/you subscription ID/resourcegroups/your resource group/providers/microsoft.compute/virtualmachines/your vm name
totalReservedQuantity : 8.000000000000000
reservedHours         : 192.000000000000000
usedHours             : 23.950000000000000

....

reservationOrderId    : xxxxxxxx-mmmm-yyyy-nnnn-zzzzzzzzzzzz
reservationId         : xxxxxxxx-mmmm-yyyy-nnnn-zzzzzzzzzzzz
usageDate             : 2019-05-10T00:00:00
skuName               : Standard_B2s
instanceId            : /subscriptions/you subscription ID/resourcegroups/your resource group/providers/microsoft.compute/virtualmachines/your vm name
totalReservedQuantity : 1.000000000000000
reservedHours         : 24.000000000000000
usedHours             : 24.000000000000000

You can retrieve which reserved instance orders have been used up or not. In addition that, you can confirm which VMs are adopted your Reserved Instance order by confirming "instanceId".

Where can you get Azure EA Onboarding Guide?

$
0
0

Almost of all EA Portal users complain about EA Portal because they can't find its manual, but you can download EA Portal manual from there.
You can download "Azure EA onboarding Guide" just following an image below.
f:id:waritohutsu:20190531161214p:plain

Now, you can retrieve the manual on your machine.
f:id:waritohutsu:20190531161411p:plain

Whose accounts you can invite into EA Portal as administrator role?

$
0
0

As you know, you can utilize Azure EA Portal to create new Azure subscriptions to charge from your EA contract. Microsoft will send an invitation mail to an account which your company has own. The account will be invited as Enterprise Administrator. Refer to an article below if you need to confirm each role on EA Portal.
normalian.hatenablog.com

Next, you need to invite accounts as new administrator roles. You have to confirm which account types are available to be invited, because there are two account types below.

  • Microsoft Account
    • This account type is also called as "Personal Account"
    • Microsoft manages this account type
    • This account type isn't one of Microsoft Azure resources
    • You could create Microsoft Account by using your corporate mail address such like yyyy@normalian.xyz in past, but you can do that no longer
  • Work or School Account

You need to utilize these accounts on EA Portal. You can find "Auth Level" menu on EA Portal below and choose a proper option to invite new administrators.
f:id:waritohutsu:20190602074000p:plain

Difference of Auth Level on EA Portal

There are four types of "Auth Level" you can choose. Assume your organization has "normalian.xyz" Azure Active Direcotry tenant and here are diagrams which account types you can invite.
f:id:waritohutsu:20190602074345p:plain

f:id:waritohutsu:20190602074450p:plain

f:id:waritohutsu:20190602074608p:plain

f:id:waritohutsu:20190602074640p:plain

Other tips

You will find error messages below if you choose wrong Auth Level. Change proper Auth Level option to invite your accounts.
f:id:waritohutsu:20190602080002p:plain

Wizard to add new administrators will be changed like below.
f:id:waritohutsu:20190602080152p:plain

How to get started with Azure Lighthouse

$
0
0

I believe some of Azure users might be concerned about how to manage Azure resources across Azure AD tenants. It should be prioritized concern especially Azure CSP users, because CSP subscription management is on the assumption of Azure AD tenants per customer.
Today, you can retrieve Azure resources across Azure AD tenants by using Azure Lighthouse.

Overview to enable Azure Lighthouse

Here are steps to enable Azure Lighthouse

  • Common Azure AD Tenant Owner:
    • Step1 : Create common Azure AD tenant – optional
    • Step2 : Create user group on common Azure AD tenant and add user accounts into the user group
  • Subscription Owner:
    • Step3 : modify ARM Template
    • Step4 : Run PowerShell command to enable Azure Lighthouse
  • Common Azure AD Tenant Owner:
    • Step 5: Retrieve Azure resources across Azure AD tenants

f:id:waritohutsu:20190922085840p:plain

You", Common Azure AD Tenant Owner", need to create a user group into the "common Azure AD tenant" - most of cases this Azure AD tenant should be owned by System Integrators or others. Users in the user group can retrieve Azure resources across Azure AD tenants via common Azure AD tenant.
In next, you, Subscription Owner, need to update an ARM template and execute powershell commands to enable Azure Lighthouse.
Let's get into details each steps.

Step1 : Create common Azure AD tenant – optional

This step is optional if you want to utilize existing Azure AD tenant as common Azure AD tenant. Refer to
Create an Azure Active Directory tenant | Microsoft Docs to create new Azure AD tenant.
You need to pick up "Directory ID" by reference to an image below.
f:id:waritohutsu:20190922091703p:plain

Step2 : Create user group on common Azure AD tenant and add user accounts into the user group

Open your common Azure AD tenant on Azure portal. Choose "Groups" from left side menus and push create "New group" button. Now, you can create new user group on Azure AD tenant by reference below.
f:id:waritohutsu:20190922090826p:plain
You need to pick up "Object ID" of this user group by following below. This ID will be used to enable Azure Lighthouse.
f:id:waritohutsu:20190922091036p:plain

You can complete this step by adding users to relish Azure Lighthouse like below.
f:id:waritohutsu:20190922091423p:plain

Step3 : modify ARM Template

You need to update an ARM Template file with picked up IDs in previous steps - Object ID and Directory ID like below. You can find RBAC Role IDs with Built-in roles for Azure resources | Microsoft Docs. You can choose "Owner", "Contributor", "Reader" or others depending on requirements of subscription owners.
f:id:waritohutsu:20190922092544p:plain

Save texts below as a JSON file and update parameters by following instructions above.

{"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {"mspName": {"type": "string",
            "metadata": {"description": "Specify the Managed Service Provider name"
            }}},
    "variables": {"mspRegistrationName": "[guid(parameters('mspName'))]",
        "mspAssignmentName": "[guid(parameters('mspName'))]",
        "mspOfferDescription": "Field Test Offer",
        "managedByTenantId": "<common Azure AD tenant ID>",
        "authorizations": [{"principalId": "<user group ID in your common Azure AD tenant ID>",
                    "roleDefinitionId": “<RBACroleID>",
		    "principalIdDisplayName": "My auth"
                },            ]
    },
    "resources": [{"type": "Microsoft.ManagedServices/registrationDefinitions",
            "apiVersion": "2019-06-01",
            "name": "[variables('mspRegistrationName')]",
            "properties": {"registrationDefinitionName": "[parameters('mspName')]",
                "description": "[variables('mspOfferDescription')]",
                "managedByTenantId": "[variables('managedByTenantId')]",
                "authorizations": "[variables('authorizations')]"
            }},
        {"type": "Microsoft.ManagedServices/registrationAssignments",
            "apiVersion": "2019-06-01",
            "name": "[variables('mspAssignmentName')]",
            "dependsOn": ["[resourceId('Microsoft.ManagedServices/registrationDefinitions/', variables('mspRegistrationName'))]"
            ],
            "properties": {"registrationDefinitionId": "[resourceId('Microsoft.ManagedServices/registrationDefinitions/', variables('mspRegistrationName'))]"
            }}],
    "outputs": {"mspName": {"type": "string",
            "value": "[concat('Managed by', '', parameters('mspName'))]"
        },
        "authorizations": {"type": "array",
            "value": "[variables('authorizations')]"
        }}
}

Step4 : Run PowerShell command to enable Azure Lighthouse

Make sure that you have already installed "Azure PowerShell module". Install "Azure PowerShell module" with reference to Install Azure PowerShell with PowerShellGet | Microsoft Docs if you haven't installed it.

Now, you can enable Azure Lighthouse by execution commands below. Please change "subscription id" and ARM Template json file name depending on your environments.

Connect-AzAccount
Get-AzSubscription 

$subscription = Get-AzSubscription -SubscriptionId "your subscription ID"
Select-AzSubscription -Subscription $subscription

New-AzDeployment -name "Towboat" -mspName "$env:USERNAME TowboatProj" -Location EastUS -TemplateUri C:\Users\myuser\Desktop\azurelighthousesetup.JSON -Verbose

Here is an image when I have tried to run the commands. It takes a few minutes to complete the command and it takes about 10 or 20 minutes to enable Azure Lighthouse on Azure Portal.
f:id:waritohutsu:20190922093533p:plain

Step 5: Retrieve Azure resources across Azure AD tenants

Find "My customers (Azure Lighthouse)" menu on Azure Portal and choose "customers" from left side menu. Now, you can find subscriptions in other Azure AD tenants like below.
f:id:waritohutsu:20190922093950p:plain

As an example to enjoy an feature of Azure Lighthouse, you can enable to retrieve Azure VMs across Azure AD tenants like below.
f:id:waritohutsu:20190922094308p:plain

How to get started with Azure Lighthouse to manage Azure resources across Azure AD tenants

$
0
0

I believe some of Azure users might worry about how to manage Azure resources across Azure AD tenants. It should be an important topic especially Azure CSP users, because CSP subscription management is on the assumption of Azure AD tenants per customer.
Today, you can retrieve Azure resources across Azure AD tenants by using Azure Lighthouse.

Overview to enable Azure Lighthouse

Here are steps to enable Azure Lighthouse

  • Common Azure AD Tenant Owner:
    • Step1 : Create common Azure AD tenant – optional
    • Step2 : Create user group on common Azure AD tenant and add user accounts into the user group
  • Subscription Owner:
    • Step3 : modify ARM Template
    • Step4 : Run PowerShell command to enable Azure Lighthouse
  • Common Azure AD Tenant Owner:
    • Step 5: Retrieve Azure resources across Azure AD tenants

f:id:waritohutsu:20190922085840p:plain

You," Common Azure AD Tenant Owner", need to create a user group into the "common Azure AD tenant" - most of cases this Azure AD tenant should be owned by System Integrators or others. User accounts in the user group can retrieve Azure resources across Azure AD tenants via common Azure AD tenant.
In next, you, Subscription Owner, need to update an ARM template and execute powershell commands to enable Azure Lighthouse.
Let's get into details each steps.

Step1 : Create common Azure AD tenant – optional

This step is optional if you want to utilize existing Azure AD tenant as common Azure AD tenant. Refer to
Create an Azure Active Directory tenant | Microsoft Docs to create new Azure AD tenant.
You need to pick up "Directory ID" by reference to an image below.
f:id:waritohutsu:20190922091703p:plain

Step2 : Create user group on common Azure AD tenant and add user accounts into the user group

Open your common Azure AD tenant on Azure portal. Choose "Groups" from left side menus and push create "New group" button. Now, you can create new user group on Azure AD tenant by reference below.
f:id:waritohutsu:20190922090826p:plain
You need to pick up "Object ID" of this user group by following below. This ID will be used to enable Azure Lighthouse.
f:id:waritohutsu:20190922091036p:plain

You can complete this step by adding users to relish Azure Lighthouse like below.
f:id:waritohutsu:20190922091423p:plain

Step3 : modify ARM Template

You need to update an ARM Template file with picked up IDs in previous steps - Object ID and Directory ID like below. You can find RBAC Role IDs with Built-in roles for Azure resources | Microsoft Docs. You can choose "Owner", "Contributor", "Reader" or others depending on requirements of subscription owners.
f:id:waritohutsu:20190922092544p:plain

Save texts below as a JSON file and update parameters by following instructions above.

{"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {"mspName": {"type": "string",
            "metadata": {"description": "Specify the Managed Service Provider name"
            }}},
    "variables": {"mspRegistrationName": "[guid(parameters('mspName'))]",
        "mspAssignmentName": "[guid(parameters('mspName'))]",
        "mspOfferDescription": "Field Test Offer",
        "managedByTenantId": "<common Azure AD tenant ID>",
        "authorizations": [{"principalId": "<user group ID in your common Azure AD tenant ID>",
                    "roleDefinitionId": “<RBACroleID>",
		    "principalIdDisplayName": "My auth"
                },            ]
    },
    "resources": [{"type": "Microsoft.ManagedServices/registrationDefinitions",
            "apiVersion": "2019-06-01",
            "name": "[variables('mspRegistrationName')]",
            "properties": {"registrationDefinitionName": "[parameters('mspName')]",
                "description": "[variables('mspOfferDescription')]",
                "managedByTenantId": "[variables('managedByTenantId')]",
                "authorizations": "[variables('authorizations')]"
            }},
        {"type": "Microsoft.ManagedServices/registrationAssignments",
            "apiVersion": "2019-06-01",
            "name": "[variables('mspAssignmentName')]",
            "dependsOn": ["[resourceId('Microsoft.ManagedServices/registrationDefinitions/', variables('mspRegistrationName'))]"
            ],
            "properties": {"registrationDefinitionId": "[resourceId('Microsoft.ManagedServices/registrationDefinitions/', variables('mspRegistrationName'))]"
            }}],
    "outputs": {"mspName": {"type": "string",
            "value": "[concat('Managed by', '', parameters('mspName'))]"
        },
        "authorizations": {"type": "array",
            "value": "[variables('authorizations')]"
        }}
}

Step4 : Run PowerShell command to enable Azure Lighthouse

Make sure that you have already installed "Azure PowerShell module". Install "Azure PowerShell module" with reference to Install Azure PowerShell with PowerShellGet | Microsoft Docs if you haven't installed it.

Now, you can enable Azure Lighthouse by execution commands below. Please change "subscription id" and ARM Template json file name depending on your environments.

Connect-AzAccount
Get-AzSubscription 

$subscription = Get-AzSubscription -SubscriptionId "your subscription ID"
Select-AzSubscription -Subscription $subscription

New-AzDeployment -name "Towboat" -mspName "$env:USERNAME TowboatProj" -Location EastUS -TemplateUri C:\Users\myuser\Desktop\azurelighthousesetup.JSON -Verbose

Here is an image when I have tried to run the commands. It takes a few minutes to complete the command and it takes about 10 or 20 minutes to enable Azure Lighthouse on Azure Portal.
f:id:waritohutsu:20190922093533p:plain

Step 5: Retrieve Azure resources across Azure AD tenants

Find "My customers (Azure Lighthouse)" menu on Azure Portal and choose "customers" from left side menu. Now, you can find subscriptions in other Azure AD tenants like below.
f:id:waritohutsu:20190922093950p:plain

As an example to enjoy an feature of Azure Lighthouse, you can enable to retrieve Azure VMs across Azure AD tenants like below.
f:id:waritohutsu:20190922094308p:plain

How does Hybrid Runbook Worker work on Azure Automation in practice?

$
0
0

I believe many Azure developers have already utilized Azure Automation to automate your management, operation and other tasks to avoid human effort. Azure Automation is fully PaaS feature on Azure, but some cases you might need to integrate its workflow with on-premise or other cloud VMs. You can utilize Hybrid Runbook Worker feature on Azure Automation to integrate Azure Automation built-in environment and other platforms.
docs.microsoft.com

Enable Hybrid Runbook Worker

You can enable both Windows and Linux platform into Hybrid Runbook Worker, but I will talk about only Windows in this post. Please refer to Azure Automation Linux Hybrid Runbook Worker | Microsoft Docs if you need.

At first, prepare your Windows Server 2012 or later machine at first, and follow steps Azure Automation Windows Hybrid Runbook Worker | Microsoft Docs.

I have followed the simplest way to setup Hybrid Runbook Worker. You need to download "New-OnPremiseHybridWorker.ps1" script from PowerShell Gallery | New-OnPremiseHybridWorker 1.6 and execute a command below as administrator on your Windows Server machine. It will take a few minutes to complete.

PS C:\Users\xxxxuser> Install-Script -Name New-OnPremiseHybridWorker	

Next, you execute commands below. This will also take a few minutes.

PS C:\Users\xxxxuser> New-OnPremiseHybridWorker.ps1 -AutomationAccountName <NameofAutomationAccount> -AAResourceGroupName <NameofResourceGroup> -OMSResourceGroupName <NameofOResourceGroup> -HybridGroupName <NameofHRWGroup>  -SubscriptionId <AzureSubscriptionId> -WorkspaceName <NameOfLogAnalyticsWorkspace>
Importing necessary modules...
     Required version 6.13.1 of AzureRM is installed...
Pulling Azure account credentials...
Connecting with the Following Parameters
Accessing Azure Automation Account named demo-automation in region southcentralus...
Referencing existing OMS Workspace named automaiton-demo-workspace in region westus...
Warning: Your Automation account and OMS workspace are in different regions and will not be compatible for future linking.
Downloading and installing the Microsoft Monitoring Agent...
Waiting for agent registration to complete...
Registering the hybrid runbook worker...

WorkspaceName and OMSResourceGroupName are optional parameters for Log Analytics and create them automatically if you don't specify them, but you need specify them if Log Analytics is unavailable in Azure Automation account region. You will get error messages below if you try to enable Hybrid Runbook Worker without putting WorkspaceName and OMSResourceGroupName in Analytics unavailable regions.

PS C:\Users\xxxxuser> New-OnPremiseHybridWorker.ps1 -AutomationAccountName <NameofAutomationAccount>  -OMSResourceGroupName <NameofOResourceGroup> -HybridGroupName <NameofHRWGroup>  -SubscriptionId <AzureSubscriptionId>
Importing necessary modules...
     Successfully installed version 6.13.1 of AzureRM...
Pulling Azure account credentials...
Connecting with the Following Parameters
Accessing Azure Automation Account named demo-automation in region southcentralus...
Creating new OMS Workspace named hybridWorkspace6163 in region westcentralus...
New-AzureRmOperationalInsightsWorkspace : HTTP Status Code: BadRequest
Error Message: New workspaces cannot be created in this region
Request Id: 28545988-a1b4-4b3e-b9bc-a0076b3bd05a
Timestamp (Utc):10/06/2019 19:03:53
At C:\Program Files\WindowsPowerShell\Scripts\New-OnPremiseHybridWorker.ps1:300 char:18
+ ... Workspace = New-AzureRmOperationalInsightsWorkspace -Location $OmsLoc ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [New-AzureRmOperationalInsightsWorkspace], CloudException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.OperationalInsights.NewAzureOperationalInsightsWorkspaceCommand

You can find your hybrid work group like below after completion the command.
f:id:waritohutsu:20191007054704p:plain

Run Runbooks on a Hybrid Runbook Worker

Refer to Run runbooks on Azure Automation Hybrid Runbook Worker | Microsoft Docs. As example, I have created new Runbook on Azure Automation like below.

$pwd = pwd
write-output $pwd 

$data = Get-Content -Path "C:\opt\localfile-01.txt" -Encoding UTF8
write-output $data 

Next, I create a new text file at C:\opt\localfile-01.txt on Azure VM enabled Hybrid Runbook Worker like below.
f:id:waritohutsu:20191007055049p:plain

Run this runbook on Azure Automation on Azure Portal. You can choose your hybrid worker as "Run Settings" like below.
f:id:waritohutsu:20191007055224p:plain

As a result, you can confirm the outputs like below.
f:id:waritohutsu:20191007055322p:plain

This means your runbook scripts will be executed at temporary folder and it's possible to utilize on-premise assets.


Why you can't find your new subscriptions on Azure Portal in spite of they has already been created on EA Portal?

$
0
0

You always need to create new Azure subscriptions on EA Portal if you have own EA contract to utilize Microsoft Azure. I have already posted an article how to get started with EA Portal like below.
normalian.hatenablog.com

It's mandatory to create your Azure subscriptions on EA Portal to charge from your monetary commitment of your EA contract. Refer to an article below which roles on EA Portal can create new Azure subscriptions.
normalian.hatenablog.com

But some folks can't find new Azure subscriptions on Azure Portal. Confirm topics below if you can't find new your subscriptions on Azure Portal.

  • Enable check of Global subscription filter for your new Azure subscription
  • Change Azure AD tenant associated with your new Azure subscription

How to create new subscriptions on EA Portal

Before describing the topics, you need to learn again how to create new subscriptions on EA Portal. Note that it's mandatory to have Account Owner role into your account like below.
f:id:waritohutsu:20190526034140p:plain
You can lunch new tab from EA Portal to create new subscription by clicking "Add Subscription" button and redirect into new page like below. Choose "Microsoft Azure Enterprise" to charge from your EA contract.
f:id:waritohutsu:20190526034222p:plain
Check two agreement terms and click "Sign up" to complete new Azure subscription.
f:id:waritohutsu:20190526034340p:plain
You will be redirected into Azure Portal like below after finishing to create the subscription but you might be not possible to find new subscription like below.
f:id:waritohutsu:20190526034517p:plain

Enable check of Global subscription filter for your new Azure subscription

Azure Portal offers "Global subscription filter" to make visible only selected subscriptions, but the new subscriptions are unchecked to visible as default.
Enable the new subscription on Global subscription filter by following like below.
f:id:waritohutsu:20190526035039p:plain

Change Azure AD tenant associated with your new Azure subscription

I believe as you know, all Azure subscriptions are associated into an Azure Active Directory tenant and have one or more subscription owners like below. In addition that, we can't list subscriptions across Azure Active Directory tenants. f:id:waritohutsu:20190526035811p:plain
This should be the cause why you can't find new Azure subscriptions even you have already enabled Global subscription filter.

New Azure subscriptions should be associated into an Azure Active Directory tenant which has your School or Work Account. It depends situations if your account is Microsoft Account. Refer to an article below if you are unfamiliar with School or Work Account and Microsoft Account.
docs.microsoft.com

Go to the new Azure subscription and choose "Change directory" like below.
f:id:waritohutsu:20190526040724p:plain

Note you need to contact Azure Active Directory tenant administrator not EA Portal administrator if you can't move the subscription into proper Azure Active Directory tenant.

How to update texts on TextInput with button clicks on PowerApps

$
0
0

I believe it might be first challenge to update text of TextInput because it's a little bit far from intuition steps. Most easiest way to understand how to build such steps are to test for yourself. Here are a one of simplest articles to describe the steps.

Simple steps how to update text on TextInput

Open https://create.powerapps.com/studio/ and choose "Blacnk App" by following an image below.
f:id:waritohutsu:20200309052838p:plain

Choose "Insert > Text -> Text Input" to put TextInput control on your app.
f:id:waritohutsu:20200309053016p:plain

Choose "Insert > Button" to put Button Control on your app.
f:id:waritohutsu:20200309053210p:plain

You can find two controls on Screen1 like below.
f:id:waritohutsu:20200309053305p:plain

You need to utilize variable to update the text. Click your InputText control, choose "Advanced" and update Data - Default as variable name - ex. "val01" like below. You can avoid error at this time because this error will be fixed after Button control setup.
f:id:waritohutsu:20200309053431p:plain

Click your button control, choose "Advance" and update "OnSelect" formula like below.
f:id:waritohutsu:20200309054422p:plain

Reset(TextInput1);
UpdateContext({val01 : "hello"});

Debug to update text on TextInput

Execute this test apps and click button, and you can confirm behavior below.
f:id:waritohutsu:20200309054803p:plain

Create Excel based simple apps with PowerApps

$
0
0

PowerApps support for various types of data sources. Of course, it's possible to connect with on-premise resources by using On-Premise Data Gateway not only Microsoft Azure data sources. In this article, you can acquire knowledge to build up simple applications to edit Excel files on OneDrive.

Create Excel file and upload it into OneDrive

Create Excel file to utilize in your PowerApps with reference to an image below. Please note to enable "My table has headers" when you create a table on the Excel file.
f:id:waritohutsu:20200311052129p:plain

Change your "Table Name" like below. This name will be used on PowerApps.
f:id:waritohutsu:20200311052342p:plain

Upload this Excel file into your OneDrive.
f:id:waritohutsu:20200311052627p:plain

Steps to generate Excel based apps

Go to https://preview.create.powerapps.com/studio/# and choose "Connections".
f:id:waritohutsu:20200311053206p:plain

Choose "New connection".
f:id:waritohutsu:20200311053332p:plain

Choose "OneDrive for Business" and click "Create" to authorize with your OneDrive for Business account.
f:id:waritohutsu:20200311053608p:plain

Confirm your connection like below.
f:id:waritohutsu:20200311053837p:plain

Next, go to "New" tab and choose "Phone layout" on OneDrive for Business.
f:id:waritohutsu:20200311054136p:plain

Choose OneDrive for Business connection which you have created just before. Next, choose your Excel file on OneDrive for Business account like below.
f:id:waritohutsu:20200311054554p:plain

Choose a table in your Excel file.
f:id:waritohutsu:20200311054732p:plain

It takes a few minutes to generate your app based on your table. You will find app below.
f:id:waritohutsu:20200311055011p:plain

Update your PowerApps application

Choose "company name" area and find formula like below.
f:id:waritohutsu:20200311055251p:plain

Update a column from "company" to "job title". This change will be immediately effected into your app like below.
f:id:waritohutsu:20200311055440p:plain

Upload Camera images into Azure Blob Storage by PowerApps

$
0
0

As you know, PowerApps offers a bunch of useful features to build up powerful applications easily. It's also possible to retrieve Microsoft Azure Platform not only Power Platform. You can acquire knowledge how upload images token by Camera into Azure Blob Storage. Here are steps to build up it.

  1. Azure Storage setup on Azure Portal
  2. Create Connection for Azure Storage on PowerApps Studio for Web
  3. Create apps by using the Connection on PowerApps Studio for Web

Azure Storage setup on Azure Portal

At first, open Azure Portal. Create Azure Storage account or choose existing one to utilize for PowerApps. Create new container to store images from PowerApps like below. The new container name is "images" in this example.
f:id:waritohutsu:20200315071807p:plain

Pick up and save "Storage account name" and "Key1" into notepad to make "Connection" on PowerApps.
f:id:waritohutsu:20200315071903p:plain

Create new Connection for Azure Storage on PowerApps Studio for Web

Next, open PowerApps Studio for Web. Choose "Connection" from left menus. You need to create new connection for Azure Storage at first.
f:id:waritohutsu:20200315072200p:plain

You will find listed connections which someone has already created like below. Choose "New connection" to create newly your Azure Storage connection.
f:id:waritohutsu:20200315072327p:plain

Find "Azure Blob Storage" by using search box like below and click "+" button.
f:id:waritohutsu:20200315072450p:plain

Put "Storage account name" and "key" into inputboxes to complete this steps.
f:id:waritohutsu:20200315072558p:plain

This isn't mandatory, but I also recommend to change your connection name to find easily in later. Find you connection by sorting with "Modifed" like below.
f:id:waritohutsu:20200315072728p:plain

You can change your connection name like here.
f:id:waritohutsu:20200315072808p:plain
Now, you have completed to make new connection for Azure Blob Storage.

Create apps by using the Connection on PowerApps Studio for Web

Open PowerApps Studio for Web and choose to create Blank new app as first. Insert "Camera" control by choosing "Insert -> Media -> Camera" like below.
f:id:waritohutsu:20200315073135p:plain

Insert new button into your app. You will find two controls as "Camera1" and "Button1" like below.
f:id:waritohutsu:20200315073401p:plain

Next, add your connection for Azure Blob Storage. Choose an icon from left side and find your connection by following step an image below.
f:id:waritohutsu:20200315074037p:plain

Put formulas into "OnSelect" action on Button control by following an image below.
f:id:waritohutsu:20200315074500p:plain

Set( imagename, "driverface" & GUID() & ".png");
AzureBlobStorage.CreateFile("images", imagename, Camera1.Photo);
||

* Run your PowerApps 
Run your application and click button, so you can find images on Azure Portal like below.

How Hybrid Runbook Worker work on Azure Automation in practice

$
0
0

I believe many Azure developers have already utilized Azure Automation to automate your management, operation and other tasks to avoid human effort. Azure Automation is fully PaaS feature on Azure, but some cases you might need to integrate its workflow with on-premise or other cloud VMs. You can utilize Hybrid Runbook Worker feature on Azure Automation to integrate Azure Automation built-in environment and other platforms.
docs.microsoft.com

Enable Hybrid Runbook Worker

You can enable both Windows and Linux platform into Hybrid Runbook Worker, but I will talk about only Windows in this post. Please refer to Azure Automation Linux Hybrid Runbook Worker | Microsoft Docs if you need.

At first, prepare your Windows Server 2012 or later machine at first, and follow steps Azure Automation Windows Hybrid Runbook Worker | Microsoft Docs.

I have followed the simplest way to setup Hybrid Runbook Worker. You need to download "New-OnPremiseHybridWorker.ps1" script from PowerShell Gallery | New-OnPremiseHybridWorker 1.6 and execute a command below as administrator on your Windows Server machine. It will take a few minutes to complete.

PS C:\Users\xxxxuser> Install-Script -Name New-OnPremiseHybridWorker	

Next, you execute commands below. This will also take a few minutes.

PS C:\Users\xxxxuser> New-OnPremiseHybridWorker.ps1 -AutomationAccountName <NameofAutomationAccount> -AAResourceGroupName <NameofResourceGroup> -OMSResourceGroupName <NameofOResourceGroup> -HybridGroupName <NameofHRWGroup>  -SubscriptionId <AzureSubscriptionId> -WorkspaceName <NameOfLogAnalyticsWorkspace>
Importing necessary modules...
     Required version 6.13.1 of AzureRM is installed...
Pulling Azure account credentials...
Connecting with the Following Parameters
Accessing Azure Automation Account named demo-automation in region southcentralus...
Referencing existing OMS Workspace named automaiton-demo-workspace in region westus...
Warning: Your Automation account and OMS workspace are in different regions and will not be compatible for future linking.
Downloading and installing the Microsoft Monitoring Agent...
Waiting for agent registration to complete...
Registering the hybrid runbook worker...

WorkspaceName and OMSResourceGroupName are optional parameters for Log Analytics and create them automatically if you don't specify them, but you need specify them if Log Analytics is unavailable in Azure Automation account region. You will get error messages below if you try to enable Hybrid Runbook Worker without putting WorkspaceName and OMSResourceGroupName in Analytics unavailable regions.

PS C:\Users\xxxxuser> New-OnPremiseHybridWorker.ps1 -AutomationAccountName <NameofAutomationAccount>  -OMSResourceGroupName <NameofOResourceGroup> -HybridGroupName <NameofHRWGroup>  -SubscriptionId <AzureSubscriptionId>
Importing necessary modules...
     Successfully installed version 6.13.1 of AzureRM...
Pulling Azure account credentials...
Connecting with the Following Parameters
Accessing Azure Automation Account named demo-automation in region southcentralus...
Creating new OMS Workspace named hybridWorkspace6163 in region westcentralus...
New-AzureRmOperationalInsightsWorkspace : HTTP Status Code: BadRequest
Error Message: New workspaces cannot be created in this region
Request Id: 28545988-a1b4-4b3e-b9bc-a0076b3bd05a
Timestamp (Utc):10/06/2019 19:03:53
At C:\Program Files\WindowsPowerShell\Scripts\New-OnPremiseHybridWorker.ps1:300 char:18
+ ... Workspace = New-AzureRmOperationalInsightsWorkspace -Location $OmsLoc ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [New-AzureRmOperationalInsightsWorkspace], CloudException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.OperationalInsights.NewAzureOperationalInsightsWorkspaceCommand

You can find your hybrid work group like below after completion the command.
f:id:waritohutsu:20191007054704p:plain

Run Runbooks on a Hybrid Runbook Worker

Refer to Run runbooks on Azure Automation Hybrid Runbook Worker | Microsoft Docs. As example, I have created new Runbook on Azure Automation like below.

$pwd = pwd
write-output $pwd 

$data = Get-Content -Path "C:\opt\localfile-01.txt" -Encoding UTF8
write-output $data 

Next, I create a new text file at C:\opt\localfile-01.txt on Azure VM enabled Hybrid Runbook Worker like below.
f:id:waritohutsu:20191007055049p:plain

Run this runbook on Azure Automation on Azure Portal. You can choose your hybrid worker as "Run Settings" like below.
f:id:waritohutsu:20191007055224p:plain

As a result, you can confirm the outputs like below.
f:id:waritohutsu:20191007055322p:plain

This means your runbook scripts will be executed at temporary folder and it's possible to utilize on-premise assets.

Viewing all 237 articles
Browse latest View live