Quantcast
Channel: Randy Riness @ SPSCC aggregator
Viewing all 3015 articles
Browse latest View live

MSDN Blogs: PowerShll on OSX 10.11 のインストール

$
0
0

先日、PowerShell on Linux を Ubuntu 16.4 にインストールする方法について記載したのですが、自宅のOSXの環境にもどうしてもインストールしてみたくなり、やってみたのでインストール方法について説明しておきます。

あまりにも簡単なので、特にはまることもありませんが、PowerShell がOSXで使えるということはOSのAutomaterでPowerShellを実行することも出来るようになるよということでもあります。

前提環境の確認

左上のりんごマーククリック→About This Mac で表示されます。

About_This_Mac

対象バージョンは、10.11 以降になります。

パッケージのダウンロード

GitHub のサイトからパッケージをダウンロードします。

GitHub_-_PowerShell_PowerShell__PowerShell_for_every_system_

※デフォルトでは、/Users/ユーザー名/Downloads にダウンロードされます。

 

Terminalを使ってのインストール

Terminalを起動してコマンドラインを実行します。sudo パスワードを忘れずに。

Last login: Sat Aug 27 12:12:05 on ttys000Mihos-MacBook-Air:~ Miho$ cd Downloads/Mihos-MacBook-Air:Downloads Miho$ sudo installer -pkg powershell-6.0.0-alpha.9.pkg -target /Password:installer: Package name is powershell-6.0.0-alpha.9installer: Installing at base path /installer: The install was successful.

起動確認とHello PowerShell

こちらも、PowerShell on Linux と同様に動作します。

Mihos-MacBook-Air:Downloads Miho$ powershellPowerShell Copyright (C) 2016 Microsoft Corporation. All rights reserved.PS /Users/Miho/Downloads> $PSVersionTable                                      Name                           Value                                           ----                           -----                                           PSVersion                      6.0.0-alpha                                     PSEdition                      Core                                            PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                         BuildVersion                   3.0.0.0                                         GitCommitId                    v6.0.0-alpha.9                                  CLRVersion                                                                     WSManStackVersion              3.0                                             PSRemotingProtocolVersion      2.3                                             SerializationVersion           1.1.0.1                                         PS /Users/Miho/Downloads> Write-Host"Hello PowerShell!!"-ForegroundColor CyanHello PowerShell!!PS /Users/Miho/Downloads> Write-Host"Hello PowerShell!!"-ForegroundColor Magenta                                                                             Hello PowerShell!!PS /Users/Miho/Downloads> ifconfig                                             lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384options=3<RXCSUM,TXCSUM>inet6 ::1 prefixlen 128 inet 127.0.0.1 netmask 0xff000000 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 nd6 options=1<PERFORMNUD>
(後半省略)

参考リンク

PowerShell is open sourced and is available on Linux

https://azure.microsoft.com/en-us/blog/powershell-is-open-sourced-and-is-available-on-linux/

 

Package installation instructions

https://github.com/PowerShell/PowerShell/blob/master/docs/installation/linux.md#macos-1011

 

本情報の内容(添付文書、リンク先などを含む)は、作成日時点でのものであり、予告なく変更される場合があります。


MSDN Blogs: Configuring the Azure Kubernetes infrastructure with Bash scripts and Ansible tasks

$
0
0

This article is the fourth one about a solution we have built with my friend Hervé Leclerc (Alter Way CTO) in order to automate a Kubernetes Cluster deployment on Azure:

·      Kubernetes and Microsoft Azure

·       Programmatic scripting of Kubernetes deployment

·       Provisioning the Azure Kubernetes infrastructure with a declarative template

·       Configuring the Azure Kubernetes infrastructure with Bash scripts and Ansible tasks

·       Automating the Kubernetes UI dashboard configuration

·       Using Kubernetes…

As we have seen previously, it’s possible to use ARM extension to execute commands on the provisioned machines. In order to automate the required setup on each machine, we may consider different options. We could manage the cluster configuration with a collection of scripts but the more efficient way is surely to keep a declarative logic instead of a pure programming approach. What we need is a consistent, reliable, and secure way to manage the Kubernetes cluster environment configuration without adding extra complexity due to an automation framework. That’s why we’ve chosen Ansible.

Ansible role in Kubernetes configuration

Ansible is a solution for configuration management based on a state-driven resource model that describes the desired state of the target, not the paths to get them to this state. Ansible role is to transform the environment to the desired state and to allow reliable and repeatable tasks without the failures risks related to scripting. So in order to handle the Kubernetes configuration, we have provisioned a dedicated Ansible controller which role is to enact configuration on the different type of nodes.

image

Ansible playbooks

Ansible automation jobs are declared with a simple description language (YAML), both human-readable and machine-parsable, in what is called an Ansible playbook.

Ansible playbook implementation

Playbooks are the entry point of an Ansible provisioning. They contain information about the systems where the provisioning should be executed, as well as the directives or steps that should be executed. They can orchestrate steps of any ordered process, even as different steps must bounce back and forth between sets of machines in particular orders.

Each playbook is composed of one or more “plays” in a list, which goal is to map a group of hosts to some well-defined roles (in our Kubernetes cluster: “master”, “node”, “etcd”) represented by tasks that call Ansible modules. By composing a playbook of multiple “plays”, it is possible to orchestrate multi-machine deployments. In our context, Ansible playbook enables to orchestrate multiple slices of the Kubernetes infrastructure topology, with very detailed control over how many machines to tackle at a time. So one of the critical task of our implementation was to create these playbooks.

When Hervé and I began to work on this automated Ansible CentOS Kubernetes deployment, we checked if there weren’t any existing asset we should build the solution upon. And we found exactly what we were looking for with the repository “Deployment automation of Kubernetes on CentOS 7” on GitHub (https://github.com/xuant/ansible-kubernetes-centos)

Note: Hervé did a fork from this git repository in order to enable further modification (https://github.com/herveleclerc/ansible-kubernetes-centos.git) and I made a submodule [“ansible-kubernetes-centos”] from this fork in order to clone this Git repository and keep it as a subdirectory of our main Git repository (to keep commits separate).

Here’s what the main playbook (https://github.com/herveleclerc/ansible-kubernetes-centos/blob/master/integrated-wait-deploy.yml) currently looks like:

 

– hosts: cluster

  become: yes

  gather_facts: false

 

  tasks:

  – name: “Wait for port 3333 to be ready”

    local_action: wait_for port=3333 host=”{{ inventory_hostname }}” state=started connect_timeout=2 timeout=600

 

– hosts: cluster

  become: yes

  roles:

    – common

    – kubernetes

 

– hosts: etcd

  become: yes

  roles:

    – etcd

 

– hosts: masters

  become: yes

  roles:

    – master

 

– hosts: minions

  become: yes

  roles:

    – minion

 

– hosts: masters

  become: yes

  roles:

    – flannel-master

 

– hosts: minions

  become: yes

  roles:

    – flannel-minion

 

Ansible playbook deployment

Ansible allows you to act as another user (through the “become: yes” declaration), different from the user that is logged into the machine (remote user). This is done using existing privilege escalation tools like sudo. As the playbook is launched through the ARM custom extension, the default requirement for a “tty” has to be disabled for the sudo users (and after playbook execution, to be re-enabled). The corresponding code that triggers the “integrated-wait-deploy.yml” playbook deployment is given with the following function:

function deploy()

{

  sed -i ‘s/Defaults    requiretty/Defaults    !requiretty/g’ /etc/sudoers

 

  ansible-playbook -i “${ANSIBLE_HOST_FILE}” integrated-wait-deploy.yml | tee -a /tmp/deploy-“${LOG_DATE}”.log

 

  sed -i ‘s/Defaults    !requiretty/Defaults    requiretty/g’ /etc/sudoers

}

 

Solution environment setup

This Kubernetes nodes and the Ansible controller should have the same level of OS packages.

Ansible controller and nodes software environment

The software environment of the virtual machines involved in this Kubernetes cluster is setup through the usage of the Open Source EPEL (Extra Packages for Enterprise Linux) Linux repository (a repository of add-on packages that complements the Fedora-based Red Hat Enterprise Linux (RHEL) and its compatible spinoffs, such as CentOS and Scientific Linux).

Current EPEL version is the following:

EPEL_REPO=http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-8.noarch.rpm

 

Please note that sometimes a new EPEL release is published without any guaranty for the previous one retention. So a current limitation with our current template is the requirement to update this EPEL url when there’s a new version for software packages hosted on EPEL repository.

The version of the EPEL repository is specified in “ansible-config.sh” and “node-config.sh” scripts with the following function:

function install_epel_repo()

{

   rpm -iUvh “${EPEL_REPO}”

}

 

Ansible controller setup

Ansible setup is achieved through a simple clone from GitHub and a compilation of the corresponding code.

Here is the code of the corresponding function:

function install_ansible()

{

  rm -rf ansible

 

  git clone https://github.com/ansible/ansible.git –depth 1

 

  cd ansible || error_log “Unable to cd to ansible directory”

 

  git submodule update –init –recursive

 

  make install

}

 

The “make install” that does the compilation first requires “Development Tools groups” to be installed.

function install_required_groups()

{

  until yum -y group install “Development Tools”

  do

    log “Lock detected on VM init Try again…” “N”

    sleep 2

  done

}

 

Ansible configuration

Ansible configuration is defined in two files, the “hosts” inventory file and the “ansible.cfg” file. The Ansible control path has to be shorten to avoid errors with long host names, long user names or deeply nested home directories. The corresponding code for the “ansible.cfg” creation is the following:

function configure_ansible()

{

  rm -rf /etc/ansible

  mkdir -p /etc/ansible

  cp examples/hosts /etc/ansible/.

  printf “[defaults]ndeprecation_warnings=Falsenn” >> “${ANSIBLE_CONFIG_FILE}”

  printf “[defaults]nhost_key_checking = Falsenn”>> “${ANSIBLE_CONFIG_FILE}”

  echo $'[ssh_connection]ncontrol_path = ~/.ssh/ansible-%%h-%%r’>>                

                                                           “${ANSIBLE_CONFIG_FILE}”  

  printf “npipelining = Truen” >> “${ANSIBLE_CONFIG_FILE}”  

 

}

Ansible connection management

Ansible represents the machines it manages using a simple INI file that organizes the Kubernetes nodes in groups corresponding to their role. In our solution we created “etcd”,”master”,”minion” groups completed by a “cluster” role that gathers all the nodes.

Here’s what the plain text inventory file (“/etc/ansible/hosts”) looks like:

image

This inventory has to be dynamically created depending on the cluster size requested in the ARM template.

Inventory based on Kubernetes nodes dynamically generated private IP

In our first ARM template implementation, each Kubernetes node launches a short “first-boot.sh” custom script in order to specify its dynamically generated private IP and its role in the cluster.

privateIP=$1

role=$2

FACTS=/etc/ansible/facts

 

mkdir -p $FACTS

echo “${privateIP},${role}”> $FACTS/private-ip-role.fact

 

chmod 755 /etc/ansible

chmod 755 /etc/ansible/facts

chmod a+r $FACTS/private-ip.fact

 

exit 0

 

In this version, the “deploy.sh” script makes ssh requests to nodes to get their private IP in order to create the inventory file. Here is an extract of the code of the corresponding function:

function get_private_ip()

{

 

  let numberOfMasters=$numberOfMasters-1

 

  for i in $(seq 0 $numberOfMasters)

  do

    let j=4+$i

       su – “${sshu}” -c “ssh -l ${sshu} ${subnetMasters3}.${j} cat $FACTS/private-ip-role.fact”>> /tmp/hosts.inv

  done

 

#…and so on for etcd, and minions nodes

}

 

Inventory based on Kubernetes nodes static ARM computed IP

In our second ARM implementation (the “linked” template composed from several ones), private IPs are computed directly in the ARM script. The following code is extracted from “KubeMasterNodes.json”:

  “resources”: [

    {

      “apiVersion”: “[parameters(‘apiVersion’)]”,

      “type”: “Microsoft.Network/networkInterfaces”,

      “name”: “[concat(parameters(‘kubeMastersNicName’), copyindex())]”,

      “location”: “[resourceGroup().location]”,

      “copy”: {

        “name”: “[variables(‘kubeMastersNetworkInterfacesCopy’)]”,

        “count”: “[parameters(‘numberOfMasters’)]”

      },

      “properties”: {

        “ipConfigurations”: [

          {

            “name”: “MastersIpConfig”,

            “properties”: {

              “privateIPAllocationMethod”: “Static”,

              “privateIPAddress”: “[concat(parameters(‘kubeMastersSubnetRoot’), ‘.’,add(copyindex(),4) )]”,

              “subnet”: {

                “id”: “[parameters(‘kubeMastersSubnetRef’)]”

              },

              “loadBalancerBackendAddressPools”: [

                {

                  “id”: “[parameters(‘kubeMastersLbBackendPoolID’)]”

                }

              ],

              “loadBalancerInboundNatRules”: [

                {

                  “id”: “[concat(parameters(‘kubeMastersLbID’),’/inboundNatRules/SSH-‘, copyindex())]”

                }

              ]

            }

          }

        ]

      }

    },

 In the “ansible-config.sh” custom script file, there is the function that creates this inventory:

function create_inventory()

{

  masters=“”

  etcd=“”

  minions=“”

 

  for i in $(cat /tmp/hosts.inv)

  do

    ip=$(echo “$i”|cut -f1 -d,)

    role=$(echo “$i”|cut -f2 -d,)

 

    if [ “$role” = “masters” ]; then

      masters=$(printf “%sn%s” “${masters}” “${ip} ansible_user=${ANSIBLE_USER} ansible_ssh_private_key_file=/home/${ANSIBLE_USER}/.ssh/idgen_rsa”)

    elif [ “$role” =“minions” ]; then

      minions=$(printf “%sn%s” “${minions}” “${ip} ansible_user=${ANSIBLE_USER} ansible_ssh_private_key_file=/home/${ANSIBLE_USER}/.ssh/idgen_rsa”)

    elif [ “$role” =“etcd” ]; then

      etcd=$(printf “%sn%s” “${etcd}” “${ip} ansible_user=${ANSIBLE_USER} ansible_ssh_private_key_file=/home/${ANSIBLE_USER}/.ssh/idgen_rsa”)

    fi

  done

 

  printf “[cluster]%sn” “${masters}${minions}${etcd}” >>“${ANSIBLE_HOST_FILE}”

  printf “[masters]%sn” “${masters}” >>“${ANSIBLE_HOST_FILE}”

  printf “[minions]%sn” “${minions}” >>“${ANSIBLE_HOST_FILE}”

  printf “[etcd]%sn” “${etcd}”       >>“${ANSIBLE_HOST_FILE}”

}

 

As you may have noticed, this file completes the IP addresses with a path for the SSH private key.

Ansible security model

Ansible does not require any remote agents to deliver modules to remote systems and to execute tasks. It respects the security model of the system under management by running user-supplied credentials and as we’ve seen includes support for “sudo”. To secure the remote configuration management system, Ansible may also rely on the default transport layer through the usage of OpenSSH, which is more secure than password authentication. This is the way we decided to secure our deployment.

In our second ARM implementationSSH key generation is done through a simple call to “ssh-keygen” (In the first one, we use existing keys).

function generate_sshkeys()

{

  echo -e ‘yn’|ssh-keygen -b 4096 -f idgen_rsa -t rsa -q -N

}

Then the configuration is done by copying the generated key file in the .ssh folder for “root” and “Ansible” users and by changing their permissions.

 

function ssh_config()

{

  printf “Host *n  user %sn  StrictHostKeyChecking non” “${ANSIBLE_USER}”  >> “/home/${ANSIBLE_USER}/.ssh/config”

 

  cp idgen_rsa “/home/${ANSIBLE_USER}/.ssh/idgen_rsa”

  cp idgen_rsa.pub “/home/${ANSIBLE_USER}/.ssh/idgen_rsa.pub”

  chmod 700 “/home/${ANSIBLE_USER}/.ssh”

  chown -R “${ANSIBLE_USER}:” “/home/${ANSIBLE_USER}/.ssh”

  chmod 400 “/home/${ANSIBLE_USER}/.ssh/idgen_rsa”

  chmod 644 “/home/${ANSIBLE_USER}/.ssh/idgen_rsa.pub”

}

 

We also have to define a way to propagate SSH keys between Ansible controller and Kubernetes nodes. At least the SSH public key is stored in the .ssh/authorized_keys file on all the computers Ansible has to log in to while the private key is kept on the computer the Ansible user log in from (in fact we have automated the copy of both public and private keys, because having the ability to SSH from any machine to the other was sometimes quite useful during development phase…). In order to do this, we use Azure Storage.

SSH Key files sharing

The “ansible-config.sh” file launched in Ansible controller generates the SSH keys and stores them in a blob in an Azure storage container with the “WriteSSHToPrivateStorage.py” Python script.

function put_sshkeys()

 {

 

  log “Push ssh keys to Azure Storage” “N”

  python WriteSSHToPrivateStorage.py “${STORAGE_ACCOUNT_NAME}” “${STORAGE_ACCOUNT_KEY}” idgen_rsa

  error_log “Unable to write idgen_rsa to storage account ${STORAGE_ACCOUNT_NAME}”

  python WriteSSHToPrivateStorage.py“${STORAGE_ACCOUNT_NAME}” “${STORAGE_ACCOUNT_KEY}” idgen_rsa.pub

  error_log “Unable to write idgen_rsa.pub to storage account ${STORAGE_ACCOUNT_NAME}”

}

Here is the corresponding “WriteSSHToPrivateStorage.py” Python function:

importsys,os

fromazure.storage.blobimport BlockBlobService

fromazure.storage.blobimport ContentSettings

 

block_blob_service = BlockBlobService(account_name=str(sys.argv[1]), account_key=str(sys.argv[2]))

block_blob_service.create_container(‘keys’)

 

block_blob_service.create_blob_from_path(

    ‘keys’,

    str(sys.argv[3]),

    os.path.join(os.getcwd(),str(sys.argv[3])),

    content_settings=ContentSettings(content_type=‘text’)

)

The “node-config.sh” file launched in Ansible controller gets the SSH key files in Azure storage with the “ReadSSHToPrivateStorage.py” Python script which code is the following:

importsys,os

 

from  azure.storage.blobimport BlockBlobService

blob_service = BlockBlobService(account_name=str(sys.argv[1]), account_key=str(sys.argv[2]))

 

blob = blob_service.get_blob_to_path(

    ‘keys’,

    str(sys.argv[3]),

    os.path.join(os.getcwd(),str(sys.argv[3])),

    max_connections=8

)

These two Python functions require the corresponding Python module to be installed on the Ansible controller and Kubernetes nodes. One easy way to do it is first to install “pip”. Pip is a package management system used to install and manage software packages written in Python. Here is the code corresponding to this setup.

function install_required_packages()

{

  until yum install -y git python2-devel python-pip libffi-devel libssl-dev openssl-devel

  do

    sleep 2

  done

}

 

function install_python_modules()

{

  pip install PyYAML jinja2 paramiko

  pip install –upgrade pip

  pip install azure-storage

}

But providing the technical mechanism to share SSH keys files between Kubernetes nodes and Ansible controller is not sufficient. We have to define how they both interact with each other.

Synchronization between Ansible controller and nodes

One of the complex requirements of the solution we propose is the way we handle the synchronization of the different configuration tasks.

ARM “depensOn” and SSH key files pre-upload solution

In our first ARM template implementation, this is easily handled through the usage of “dependsOn” attribute in the ARM template. This solution requires all the nodes to be deployed before launching the Ansible playbook with a custom “deploy.sh” script extension. This script is deployed on the Ansible controller with the “fileUris” settings (“scriptBlobUrl”). The others filesUris correspond to the SSH key files used for Ansible secure connection management (and another token file used for monitoring through Slack).

In this solution, synchronization between Ansible controllers and node is quite easy but requires the publication of SSH key files in an Azure storage account (or an Azure Key vault) before launching the template deployment, so Ansible controller may download them before running the playbooks. If these files are not deployed before launching the deployment, it will fail. Here are the corresponding files displayed with the Azure Management Studio tool.

image

 

The following code is extracted from the “azuredeploy.json” and corresponds to the Ansible extension provisioning.

image

Netcat synchronization and automated Python SSH key files sharing through Azure Storage

The second ARM implementation (the “linked” template composed from several ones) enables to avoid to pre-publish keys in a vault by directly generating these keys during deployment. As this solution may appear more elegant and more secure, by specializing a generated SSH key for Ansible configuration management instead of sharing existing keys for other purpose, it adds a significant level of complexity, because it requires now to handle in parallel both Ansible controller and Kubernetes nodes configuration.

The bash script on the Ansible controller generates SSH keys but have to wait for the nodes to get theses keys and declared them as authorized for logon before launching the Ansible playbook. A solution to this kind of scenario may be implemented thanks to the usage of Netcat, a networking utility using the TCP/IP protocol, which reads and writes data across network connections, and that can be used directly or easily driven by other programs and scripts. The way we synchronized both scripts “config-ansible.sh” and “config-node.sh” is described with the following schema.

image

So the first machines which have to wait are the nodes. As they are waiting for getting a file, it’s quite simple to have them making this request periodically in pull mode until the file is there (with a limit on attempts number). The code extracted from “config-node.sh” is the following.

function get_sshkeys()

 {

    c=0;

 

   sleep 80

    untilpython GetSSHFromPrivateStorage.py“${STORAGE_ACCOUNT_NAME}” “${STORAGE_ACCOUNT_KEY}”idgen_rsa

    do

        log “Fails to Get idgen_rsa key trying again …” “N”

        sleep 80

        let c=${c}+1

        if [ “${c}” -gt 5 ]; then

           log “Timeout to get idgen_rsa key exiting …” “1”

           exit 1

        fi

    done

    python GetSSHFromPrivateStorage.py“${STORAGE_ACCOUNT_NAME}” “${STORAGE_ACCOUNT_KEY}”idgen_rsa.pub

}

In order to launch the Netcat server in the background (using the & command at the end of the line), and logout from the “config-node.sh” extension script session without the process being killed, the job is executed with “nohup” command (which stands for “no hang up”).

To make sure that the Netcat server launching will not interfere with foreground commands and will continue to run after the extension script logouts, it’s also required to define the way input and output are handled. The standard output will be redirected to “/tmp/nohup.log” file (with a “> /tmp/nohup.log” and the standard error will be redirected to stdout (with the “2>&1” file descriptor), thus it will also go to this file which will contain both standard output and error messages from the Netcat server launching. Closing input avoids the process to read anything from standard input (waiting to be brought in the foreground to get this data). On Linux, running a job with “nohup” automatically closes its input, so we may consider not to handle this part, but finally the command I decided to use was this one.

function start_nc()

{

  log “Pause script for Control VM…” “N”

  nohup nc -l 3333 </dev/null >/tmp/nohup.log 2>&1 &

}

The “start_nc()” function is the last one called in the “config-node.sh” file, which is executed on each cluster node. On the other side, the “ansible-config.sh” file launched in Ansible controller executes without any pause and launches the Ansible playbook. This is the role of this playbook to wait for the availability of the Netcat Server (that shows that the “config-node.sh” script is terminated with success). This is easily done with the simple task we’ve already seen. This task is executed for any host belonging to the Ansible “cluster” group, i.e all the Kubernetes cluster nodes.

– hosts: cluster

  become: yes

  gather_facts: false

 

  tasks:

  – name: “Wait for port 3333 to be ready”

    local_action: wait_for port=3333 host=”{{ inventory_hostname }}” state=started connect_timeout=2 timeout=600

One last important point is how we handle the monitoring of the automated tasks.

Monitoring the automated configuration

Monitoring this deployment part supposes to be able to monitor both custom script extension and Ansible playbook execution.

Custom script logs

One way to monitor both script extension and Ansible automated configuration is to connect to the provisioned VM and check the “stdout” and the “errout” files in the waagent (Azure Microsoft Azure Linux Agent that manages Linux VM interaction with the Azure Fabric Controller) directory :  “/var/lib/waagent/Microsoft.OSTCExtensions.CustomScriptForLinux-1.4.1.0/download/0”

image

A more pleasant way is to monitor the custom script execution directly from Slack.

image

In order to get in realtime the output from the “ansible-config.sh” and “node-config.sh” deployment custom script, you just have to define “Incoming WebHooks” in your Slack team project.

image

This gives you a WebHook extension URL which can directly be called from those bash scripts in order to send your JSON payloads to this URL.

LOG_URL=https://hooks.slack.com/services/xxxxxxxx/yyyyyyy/zzzzzzzzzzzzzzzzzzzzzz

 

Then it’s quite easy to integrate this in a log function such as this one:

function log()

{

  #…

  mess=“$(date) – $(hostname): $1 $x”

 

  payload=“payload={“icon_emoji”:”:cloud:”,”text”:”$mess”}”

  curl -s -X POST –data-urlencode “$payload” “$LOG_URL” > /dev/null 2>&1

   

  echo “$(date) : $1”

}

Ansible logs

Ansible logs may also be read from playbook execution output which is piped to a tee command in order to write it to the terminal, and to the /tmp/deploy-“${LOG_DATE}”.log file.

image

Once again it’s possible to use Slack to get Ansible logs in realtime. In order to do that we have used an existing Slack Ansible plugin (https://github.com/traveloka/slack-ansible-plugin) which I added as submodule of our GitHub solution (https://github.com/stephgou/slack-ansible-plugin). Once it’s done, we just have to get the Slack incoming WebHook token in order to set the SLACK_TOKEN and SLACK_CHANNEL.

Please note that for practical reasons, I used base64 encoding in order to avoid to handle vm extension “fileuris” parameters outside of Github, because Github forbids token archiving. This current implement choice is definitely not a best practice. An alternative could be to put a file in a vault or a storage account and copy this file from the config-ansible.sh.

The corresponding code is extracted from the following function:

 

function ansible_slack_notification()

{

  encoded=$ENCODED_SLACK

  token=$(base64 -d -i <<<“$encoded”)

 

  export SLACK_TOKEN=“$token”

  export SLACK_CHANNEL=“ansible”

 

  mkdir -p “/usr/share/ansible_plugins/callback_plugins”

  cd “$CWD” || error_log “unable to back with cd ..”

  cd “$local_kub8/$slack_repo”

  pip install -r requirements.txt

  cp slack-logger.py /usr/share/ansible_plugins/callback_plugins/slack-logger.py

}

Thanks to this plugin it’s now possible to directly get Ansible logs in Slack.

image

Conclusion

The combination of ARM templates, custom script extension files and Ansible playbooks enabled us to install the required system packages to setup and configure Ansible, to deploy required Python modules (for example in order to share SSH key files through Azure Storage), to synchronize our nodes configuration and execute Ansible playbooks to finalize the Kubernetes deployment configuration.

Next time we’ll see how to automate the Kubernetes UI dashboard configuration… Stay tuned !

MSDN Blogs: Azure News on Friday (KW34/16)

$
0
0

Auch diese Woche gab’s wieder viele Nachrichten zur Microsoft Azure Plattform. Hier sind nähere Infos dazu…

Aktuelle Neuigkeiten

DatumNachricht
26.08. Onboarding to Azure Web Marketplace
Eigene Web Apps im Azure Web Marketplace veröffentlichen
26.08. New App Service quota UX
Einsicht in die Quotas eigener Azure Web Apps die in der Leistungsstufe Free oder Shared betrieben werden
26.08. How to register U-SQL Assemblies in your U-SQL Catalog
Eigene U-SQL Assemblies für Azure Data Lake Analytics im U-SQL Catalog registrieren
26.08. HDInsight:- Attach additional Azure storage accounts to the cluster
Einem HDInsight Cluster weitere Azure Storage Accounts hinzufügen
25.08. Public preview: Computer Vision API and Academic Knowledge API in Cognitive Services
Computer Vision API (Analyse von Bilddaten) und Academic Health API in Cognitive Services als Preview
25.08. Public preview: N-Series instances for Azure Virtual Machines
Azure N-Series Virtual Machines (mit GPU-Support) in Zusammenarbeit mit Nvidia als Preview verfügbar
24.08. General availability: New Azure SQL Database Premium performance level, P15
Neues Performance Level für Azure SQL Databases P15 – 4000 DTUs und bis zu 1 TB Speicher
24.08. JSON support is generally available in Azure SQL Database
JSON Unterstützung jetzt in Azure SQL Database verfügbar
23.08. Azure Event Hubs Client for Java 0.8.0 is now live
Die Azure Event Hubs Client Library für Java ist in Version 0.8.0 auf GitHub verfügbar

Neue Kurse in der MVA

DatumNachricht
27.08. Deploying Web Apps to Azure App Service
Web Apps in den Azure App Service deployen
27.08. Deploying Dockerized Apps to the Azure Container Service
Docker Apps in den Azure Container Service deployen

Neue Videos

DatumNachrichtVideo
26.08. Episode 210: Service Fabric Series (1 of 3) – Introduction
Neue Videoserie zur Azure Service Fabric – hier Teil 1 von 3
26.08. Azure CDN with Akamai
Einstieg in die Verwendung von Azure CDN mit Akamai
25.08. Mocking responses
API Responses via API Management liefern, auch wenn das eigentliche API Backend nicht zur verfügung steht
23.08. SQL Server 2016 with StretchDB, Temporal, and AlwaysEncrypted
Überblick zum neuen SQL Server 2016 – StretchDB, Temporal, AlwaysEncrypted

MSDN Blogs: Shooting a Visual Studio Toolbox episode with Robert Green

$
0
0

While shopping at Costo last night, noticed an old friend Robert Green and his beautiful wife Collette happen to be checking out in front of us  (they even came down and visited us while in Australia).  While chatting the topic of work came up and the fact I am now on the Power BI team and Robert asked if we would be slowing down the crazy/torrid development pace of delivering new features.  Not only will we NOT be slowing down a pace of delivery; with the work around Cortana, Azure and continued push to get new collaboration features into the Power BI Service it is likely it will be increasing!  With this news Robert asked if i would be interested in doing a Visual Studio Toolbox episode…doh -OF COURSE!  Since this is developer focused series i decided to show off some of the Power BI features i thought developers would be interested in:

 

Calling REST APIs, working with JSON and integrating with your Web Development using Power BI

In this week’s Visual Studio Toolbox episode, old time friend, Charles Sterling joins us to show how to use Power BI in your development efforts specifically how to call REST APIs with Power BI without writing any code.  Parsing, modeling and transforming the resulting JSON to make creating rich interactive reports a snap and integrating this into your  development efforts by embedding the Power BI data visualizations into your web applications.

 

http://aka.ms/chassbio

MSDN Blogs: SPO : PowerShell to get Custom Actions in a Site Collection

$
0
0

[System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint.Client”)
[System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint.Client.Runtime”)

$siteUrl = Read-Host -Prompt “Enter sitecollection url”
$username = Read-Host -Prompt “Enter user login name”
$password = Read-Host -Prompt “Enter user login password” -AsSecureString
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl)

# SharePoint Online
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $password)
$ctx.Credentials = $credentials

$rootWeb = $ctx.Site
$ctx.Load($rootWeb)
$ctx.ExecuteQuery()
$caColl = $rootWeb.get_userCustomActions()
$ctx.Load($caColl)
$ctx.ExecuteQuery()

Write-Host
Write-Host ‘Total number of custom actions: ‘$caColl.Count
$count = 1
$caColl | ForEach-Object {
Write-Host $count’)’  $_.Name
$count++
}

MSDN Blogs: SharePoint Online : Securing Add-in Principals

$
0
0

For the remote components of a provider-hosted SharePoint Add-in to interact with SharePoint using OAuth, the add-in must first register with the Azure ACS cloud-based service and the SharePoint App Management Service of the tenancy. The registration involves creating new Client ID/Secret and other add-in specific details. After you register your add-in, it has an add-in identity and is a security principal, referred to as an add-in principal. When you install your add-in, SharePoint administrators can retrieve information about that particular add-in principal. The Client ID/Secret values need to be entered in configuration file of the application. Anyone who has access to the file system of the config file location can read these values. Using these values, they can build their own application and do anything in the SharePoint they want to (though its only restricted to app permissions defined for the app principal). This can become a big security threat especially if the app is given app-only policy permission.

This is a governance problem. Any organization need to have well defined governance on the deployment process, person responsible in making the changes in the configuration file and so on. If the config file is not well protected enough, it can become a problem. To address this scenario, we need to secure the app principle itself, so that even if someone gets access to these principles they shouldn’t be able to do anything with it. The idea is to encrypt the key values using Triple-DES algorithm at Machine level. Using the encrypted value generated in one machine we can’t decrypted the value in another machine, it has to be decrypted in the same machine. When an application calls the DPAPI encryption routine, it can specify an optional secondary entropy (“secret” bytes) that will have to be provided by an application attempting to decrypt data.

The solutions consists of 2 parts – Encryption (Generated using an Exe application) and Decryption (Used in the actual add-in application);

Encryption

  • Enter the Client ID or the Secret value in Client ID/Secret text box.
  • Entropy key is optional field.
  • Choose the scope as Local Machine (this is the default value)
  • Click Encrypt button to get the encrypted text value and hit copy text to copy the values.

Validation

To validate the encrypted text, without altering any values, click the Decrypt button and you should see the original value of the ID/Secret given.

If the value is tampered or if you try to use the encrypted text value in a different machine, the decryption will fail.

 

Decryption

The encrypted value is stored in the configuration file.  The add-in application uses EncryptionUtility class DecryptStringWithDPAPI method to get the decrypted value.  For e.g. in the TokenHelper.cs of an Add-In application, to get the actual value of Client Secret, here is the code;

private static SecureString stringClientSecret = EncryptionUtility.DecryptStringWithDPAPI(WebConfigurationManager.AppSettings.Get(“ClientSecret”)) ;

private static readonly string ClientSecret = EncryptionUtility.ToInsecureString(stringClientSecret);

The complete solution can be downloaded here – https://github.com/OfficeDev/PnP/tree/master/Solutions/Governance.AddInSecurity

 

MSDN Blogs: 5 diagnostických vychytávek, které ještě v Application Insights neznáte

$
0
0

1. Proactive Detection a unifikace oznámení

Již po vytvoření služby Application Insights je automaticky aktivní funkce Proactive Detection. Ta na základě prediktivní analýzy a obecně analýzy sesbíraných dat dokáže hledat anomálie v chování aplikace. Ze života mohu uvést příklad, kdy jsem omylem nasadil verzi aplikace s neaktivní Output Cache. Služba Proactive Detection dokázala do 3 minut po nasazení upozornit na to, že odbavení reqestů trvá netradičně déle. V takovém případě jsem automaticky upozorněn e-mailem, který má nyní pro různá oznámení unifikovaný vzhled. Součástí e-mailu jsou informace:

  • kdy nastala nestandardní událost
  • co se děje špatně
  • jak by to mělo být
  • poznámka, kolik tato událost ovlivnila uživatelů

proactive-detection-aug-2016

Kromě e-mailu je možné všechny události spravovat i přímo v portálu.

2. Widget pro VSTS Dashboard

Vývojový tým si uvědmuje, že mnoho vývojářů používá službu Visual Studio Team Services pro správu zdrojového kódu a tasků. VSTS poskytuje již delší dobu možnost instalovat si různá rozšíření skrze VSTS Marketplace. Jedním takovým rozšířením je widget, který umí na VSTS Dashboard propsat stav libovolné metriky. V praxi můžete po přihlášení do VSTS vidět například průměrnou dobu odbavení requestu ve vybraném čase. Pokud taková hodnota přeroste přes nadefinovaný threshold, umí se dlaždice přebarvit a upozornit na nestandardní chování aplikace. Z dlaždice je možné přejít rovnou do portálu ke službě Application Insights.

application-insights-widget-in-vsts

3. Tvorba work items z Application Insights na GitHub

Podobně jako v případě VSTS vývojáři služby Application Insights připravili integraci work itemů pro GitHub. Pokud je nyní vývojář v portálu Microsoft Azure a najde ve službě Application Insights problém, může z něj vytvořit nový work item na GitHubu. To se hodí především při vytváření issues souvisejících s performance nebo bugy. Připojení GitHub účtu se provádí v nastavení služby Application Insights na záložce Work Items. Tam je mimo jiné možné stejným způsobem připojit VSTS.

propojeni-se-sluzbou-github

Samotné vytvoření work itemu je už hračka.

zalozeni-workitemu-na-githubu

Výsledek se projeví na GitHubu prakticky okamžitě.

zalozeni-workitemu-na-githubu-vysledek

4. Propojení Analytics Query do dashboardu na Azure portálu

Jedna z vynikajících funkcí služby Application Insights je speciální portál Analytics, který umožňuje sestavovat nad sesbíranými telemetriemi různé dotazy specifickou syntaxí (podobnou LINQu).

vstup-na-portal-app-insights-analytics

Nově je možné výsledky těchto dotazů (gridy, grafy) promítnout na dashboard Azure portálu. Díky tomu již není nutné vracet se do Analytics portálu jen pro kontrolu sledovaných metrik. Podmínkou pro propsání je, aby byl vybraný dashboard sdílený.

Analytics portál byl zpřehledněn

Výše zmíněný Analytics portál je relativně nový (není s námi déle než 6 měsíců). Přesto se dynamicky rozvíjí a v posledních týdnech doznal i řady vizuálních změn.

dashobard-analytics-portalu

V krásném tmavém designu jsou zakomponovány ukázky dotazů, se kterými lze ihned využívat portálu i bez znalosti specifického dotazovacího jazyka. Příkladem budiž základní dotaz rozdělující dobu odbavení requestu do percentilů a následnou projekci do grafu.

performance-prusvih-na-prvni-pohled

5. App Insights Performance Counters dostupné pro Web Apps

Performance counters byly donedávna dostupné pouze pro on-premises řešení, virtuální stroje a cloud services. Protože Web Apps neběžely na svém vlastním stroji, nebyly pro tuto službu podporovány. Nově je zpřístupněn NuGet balíček Application Insights SDK Labs, který tuto funkci přidává.

Protože je balíček mimo oficiální NuGet, doporučuji instalaci přes command line přímo ve VS:

Install-Package "Microsoft.ApplicationInsights.DependencyCallstacks" -Source "https://www.myget.org/F/applicationinsights-sdk-labs/" -Pre

A to máme pro dnešek vše. Služba Application Insights se rozvíjí každým týdnem a poskytuje vývojářům velmi silnou diagnostickou zbraň. Pokud hledáte nástroj pro logování chyb a diagnostiku aplikace včetně sledování performance counters, Application Insights doporučuji vyzkoušet. Zdarma dostanete nejen velmi pokročilý nástroj pro sběr telemetrií ale především i sadu nástrojů pro jejich následnou analýzu.

Miroslav Holec
23. srpna 2016

MSDN Blogs: My Personal FAQ on HDInsight HBase & Phoenix

$
0
0

I will keep this page updated with HDinsight HBase/ Phoenix related commonly asked questions. You can leave comments/questions on this blog as well as follow me on twitter

Official channel to provide HDInsight related feedback and make feature requests is here

What is the advantage of using HBase in Azure HDinight?

Azure HDInsight HBase – A NoSql database like no other

 

Can’t wait , give me a quick link to deploy HBase cluster in HDInsight?

So, I just got HBase up and running in HDInsight and want to test the performance without writing any code. How can I “take HBase for a spin”?  

SSH into your cluster , and type
hbase org.apache.hadoop.hbase.PerformanceEvaluation 1000

PerformanceEvaluation tool takes number of parameters and commands , just type hbase org.apache.hadoop.hbase.PerformanceEvaluation for all the options. 

org.apache.hadoop.hbase.PerformanceEvaluation

Now go to HBase Shell and type list ,  you will see a new table and you can play with many more options.

Great! I am an enterprise customer and secure the cluster inside a virtual network. How can I do that?

Please follow the article Here

I really need to secure the VNET , what IP & ports Azure needs to operate the service

If you need to install HDInsight into a secured Virtual Network, you must allow inbound access over port 443 for the following IP addresses, which allow Azure to manage the HDInsight cluster.

168.61.49.99
23.99.5.239
168.61.48.131
138.91.141.162

Allowing inbound access from port 443 for these addresses will allow you to successfully install HDInsight into a secured virtual network.

There are some inconsistencies when running “hbase hbck”. Then I want to run “sudo -u hbase<or hdfs> hbase hbck -repair”, it reports access denied to the folders in azure data lake store
Try adding “-ignorePreCheckPermission” as a command parameter

hbase hbck -ignorePreCheckPermission

 


MSDN Blogs: HDInsight -New self-paced trainings and labs

$
0
0

This week Microsoft Learning Experiences released/updated 3 HDInsight courses ( These are free , $49 if you need a course Certificate)

Create HDInsight cluster

Processing Big Data with Azure HDInsight

Start course

More and more organizations are taking on the challenge of analyzing big data. This course teaches you how to use the Hadoop technologies in Microsoft Azure HDInsight to build batch processing solutions that cleanse and reshape data for analysis. In this five-week course, you’ll learn how to use technologies like Hive, Pig, Oozie, and Sqoop with Hadoop in HDInsight; and how to work with HDInsight clusters from Windows, Linux, and Mac OSX client computers.

Course Syllabus

Module 1: Getting Started with HDInsight
The course begins with an introduction to big data concepts and Hadoop, before examining Microsoft Azure HDInsight and the Hadoop distribution it provides. You’ll learn how to provision an HDInsight cluster, upload data to the cluster, and perform Map/Reduce jobs that process the data.

Module 2: Processing Big Data with Hive
The second week of the course is all about Hive. You’ll learn how to create Hive tables and use HiveQL to query them, before exploring some advanced Hive techniques like partitioning and indexing.

Module 3: Going Beyond Hive
In the third week of the course, you’ll learn how to use Pig to process big data, and how to extend the capabilities of Pig and Hive by using user-defined functions implemented in Python.

Module 4: Building a Big Data Workflow
Week four builds on the data processing techniques covered in previous weeks, and teaches you how to build an end-to-end big data processing workflow using Oozie and Sqoop.

Final Exam
The fifth week of the course is given over the final exam. You must achieve a score of 50% or higher to pass this course and earn a certificate.

Implementing Real-Time Analysis with Hadoop in Azure HDInsight

Start course

In this four week course, you’ll learn how to implement low-latency and streaming Big Data solutions using Hadoop technologies like HBase, Storm, and Spark on Microsoft Azure HDInsight.

Course Syllabus

Use HBase to implement low-latency NoSQL data stores.
Use Storm to implement real-time streaming analytics solutions.
Use Spark for high-performance interactive data analysis.

Implementing Predictive Solutions with Spark in Azure HDInsight

Start course

In this course, learn how to implement predictive analytics solutions for big data using Apache Spark in Microsoft Azure HDInsight. You will learn how to work with Scala or Python to cleanse and transform data, build machine learning models with Spark MLlib (the machine learning library in Spark), and create real-time machine learning solutions using Spark Streaming. Plus, find out how to use R Server on Spark to work with data at scale in the R language


Course Syllabus

Using Spark to work with data
Preprocessing data for machine learning in Spark
Building machine learning models in Spark
Using R at scale with R Server on Spark.

Credit :Graeme Malcolm

 

MSDN Blogs: HDInsight -New self-paced trainings and labs

$
0
0

cross post from https://blogs.msdn.microsoft.com/azuredatalake/2016/08/28/hdinsight-new-self-paced-trainings-and-labs/

This week Microsoft Learning Experiences released/updated 3 HDInsight courses ( These are free , $49 if you need a course Certificate)

Create HDInsight cluster

Processing Big Data with Azure HDInsight

Start course

More and more organizations are taking on the challenge of analyzing big data. This course teaches you how to use the Hadoop technologies in Microsoft Azure HDInsight to build batch processing solutions that cleanse and reshape data for analysis. In this five-week course, you’ll learn how to use technologies like Hive, Pig, Oozie, and Sqoop with Hadoop in HDInsight; and how to work with HDInsight clusters from Windows, Linux, and Mac OSX client computers.

Course Syllabus

Module 1: Getting Started with HDInsight
The course begins with an introduction to big data concepts and Hadoop, before examining Microsoft Azure HDInsight and the Hadoop distribution it provides. You’ll learn how to provision an HDInsight cluster, upload data to the cluster, and perform Map/Reduce jobs that process the data.

Module 2: Processing Big Data with Hive
The second week of the course is all about Hive. You’ll learn how to create Hive tables and use HiveQL to query them, before exploring some advanced Hive techniques like partitioning and indexing.

Module 3: Going Beyond Hive
In the third week of the course, you’ll learn how to use Pig to process big data, and how to extend the capabilities of Pig and Hive by using user-defined functions implemented in Python.

Module 4: Building a Big Data Workflow
Week four builds on the data processing techniques covered in previous weeks, and teaches you how to build an end-to-end big data processing workflow using Oozie and Sqoop.

Final Exam
The fifth week of the course is given over the final exam. You must achieve a score of 50% or higher to pass this course and earn a certificate.

Implementing Real-Time Analysis with Hadoop in Azure HDInsight

Start course

In this four week course, you’ll learn how to implement low-latency and streaming Big Data solutions using Hadoop technologies like HBase, Storm, and Spark on Microsoft Azure HDInsight.

Course Syllabus

Use HBase to implement low-latency NoSQL data stores.
Use Storm to implement real-time streaming analytics solutions.
Use Spark for high-performance interactive data analysis.

Implementing Predictive Solutions with Spark in Azure HDInsight

Start course

In this course, learn how to implement predictive analytics solutions for big data using Apache Spark in Microsoft Azure HDInsight. You will learn how to work with Scala or Python to cleanse and transform data, build machine learning models with Spark MLlib (the machine learning library in Spark), and create real-time machine learning solutions using Spark Streaming. Plus, find out how to use R Server on Spark to work with data at scale in the R language


Course Syllabus

Using Spark to work with data
Preprocessing data for machine learning in Spark
Building machine learning models in Spark
Using R at scale with R Server on Spark.

Credit :Graeme Malcolm

 

MSDN Blogs: Microsoft Dynamics CRM Online 2016 更新プログラム 1 新機能: フィールド サービス: スケジュール ボード

$
0
0

みなさん、こんにちは。

Microsoft Dynamics CRM Online 2016 更新プログラム 1 新機能からフィールド サービスについて紹介します。
本記事はシリーズもののため、前回の記事をご覧になっていない方は合わせてご参照ください。

Microsoft Dynamics CRM Online 2016 更新プログラム 1 新機能: フィールド サービス: 概要
Microsoft Dynamics CRM Online 2016 更新プログラム 1 新機能: フィールド サービス: 事前準備
Microsoft Dynamics CRM Online 2016 更新プログラム 1 新機能: フィールド サービス: 作業指示書の作成、割り当て
Microsoft Dynamics CRM Online 2016 更新プログラム 1 新機能: フィールド サービス: 予約の確認、作業完了報告

今回は、スケジュール ボード機能についてより詳細に紹介していきます。

 

スケジュール ボード

スケジュール ボードを構成する要素はいくつかあります。

– フィルターおよびマップ ビュー
– 構成タブ
– 詳細ビュー
– スケジュールなしの作業指示書
– タブ

image

フィルターおよびマップ ビュー

フィルターおよびマップ ビューは、中央のビューに表示する情報をフィルターするための機能です。
フィルターは、リソースの種類、サービスの地域、リソースの 3 つに対してフィルターすることができます。

1. すべてのリソースが表示さていることを確認します。

image

2. 表示したいリソースのみに変更します。

image

3. [フィルターの適用] ボタンをクリックします。

image

4. 中央のビューに選択したリソースのみが表示されていることが分かります。

image

 

構成タブ

中央部のカレンダーが表示されている構成タブは、作業指示書をリソースに割り当てたり、
割り当たっている予約を確認することができます。

予約状況の確認

表示されているリソースに割り当たっている予約を確認することができます。
またその予約の状態(スケジュール済み、完了など)が色で視覚的にわかります。

image

予約にカーソルを当てると、予約の概要がポップアップされます。

image

時間の切り替え

左上のメニューにて、表示形式を変更することができます。

image

ビューの表示形式の切り替え

image

[水平ビュー]

image

[垂直ビュー]

image

[マップ ビュー]

Bing Map 上に予約とリソースの設定されている住所が表示されます。
地図は、マウス操作で動かしたり拡大、縮小したりすることができます。

image

ピンをマウスオーバーすると予約の概要が見れます。

image

マップ ビューの左上のツールメニューによって地図の操作や説明を見ることができます。

[道路]

image

[凡例]

ピンの色の意味が表示されます。

image

構成タブの設定変更

右上のアイコンをクリックすると設定を変更することができます。

image

タブ

利用者ごとに独自のタブを追加することができます。既定で「最初の共有ビュー」タブが作成されています。

タブの追加

1. Dynamics CRM にログインします。

2. [フィールド サービス] > [スケジュール ボード] をクリックします。

image

3. 上部にある「+」アイコンをクリックします。

image

4. タブの各種設定を選択し、追加をクリックします。

image

5. 表示されます。

image

タブの削除

1. 削除するタブの [×] アイコンをクリックします。

image

2. [はい] をクリックします。

image

3. タブが削除されます。

まとめ

スケジュール ボードは、フィールド サービスの強力な機能の一つです。
次回は、モバイル アプリケーションの機能をより詳細に紹介していきます。

– プレミアフィールドエンジニアリング 河野 高也

※本情報の内容(添付文書、リンク先などを含む)は、作成日時点でのものであり、予告なく変更される場合があります

MSDN Blogs: [Sample Of Aug. 29] How to add a picture watermark with online image in Word 2016 using JavaScript

$
0
0
image
Aug.
29
image
image

Sample : https://code.msdn.microsoft.com/How-to-add-a-picture-45acc92d

This sample demonstrates how to add or remove the picture watermark in Word 2016.

image

You can find more code samples that demonstrate the most typical programming scenarios by using Microsoft All-In-One Code Framework Sample Browser or Sample Browser Visual Studio extension. They give you the flexibility to search samples, download samples on demand, manage the downloaded samples in a centralized place, and automatically be notified about sample updates. If it is the first time that you hear about Microsoft All-In-One Code Framework, please watch the introduction video on Microsoft Showcase, or read the introduction on our homepage http://1code.codeplex.com/.

MSDN Blogs: Experiencing Data Access Issue in Azure Portal for Availability Data Type – 08/28 – Resolved

$
0
0
Final Update: Monday, 29 August 2016 03:33 UTC

We’ve confirmed that all systems are back to normal with no customer impact as of 08/29, 3:30 AM UTC. Our logs show the incident started on 08/28, 8:45 PM UTC and that during the 6 hours 45 minutes that it took to resolve the issue  less than 1% of customers experienced failures while trying to create and modify web tests and alerts in the Azure Portal.
  • Root CauseThe failure was due to some inconsistencies experienced in downstream alerting systems.
  • Incident Timeline: 6 Hours & 45 minutes – 08/28, 8:45 PM UTC through 08/29, 3:30 AM UTC.

We understand that customers rely on Application Insights as a critical service and apologize for any impact this incident caused.

-Sapna


Update: Monday, 29 August 2016 01:20 UTC

We continue to investigate issues within Application Insights. Root cause is not fully understood at this time. Some customers may continue to experience failures to create and modify web tests and alerts. We currently have no estimate for resolution.
  • Work Around: None
  • Next Update: Before 08/29 05:30 UTC

-Sapna


Initial Update: Sunday, 28 August 2016 23:10 UTC

We are aware of issues within Application Insights and are actively investigating. Some customers may experience delays in creation or updates to the web tests and alerts, starting around 08/28, 8:45 PM UTC. The following data types are affected: Availability.
  • Work Around: None
  • Next Update: Before 08/29 01:30 UTC

We are working hard to resolve this issue and apologize for any inconvenience.


-Sapna

MSDN Blogs: Windows update KB3176934 インストール後、SfB Online の PowerShellが利用できない

$
0
0

SfB サポートのワトソンです。

米国時間の 2016 8 23 日に Windows Client 用の Windows update KB3176934 がリリースされました。

Windows 10 上で、本更新プログラムのパッケージに .MOF ファイルが欠落していることにより “不正なプロパティ” エラーが発生し PowerShell DSC の処理に失敗します。

また、上記バイナリファイルが欠落していることで、リモートセッションへの接続に失敗し、以下コマンドを実行するとエラーが発生します。

$remoteSession = New-PSSession -Cn TargetComputer Import-PSSession -Session $remoteSession

エラー(英語表記):

Import-PSSession : Could not load type System.Management.Automation.SecuritySupportfrom assembly System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.

上記の通りライブラリ内でエラーが発生するためアセンブリーエラーとなります。

本問題に対する修正プログラムを米国時間 2016 8 30 日 にリリースすることを予定しております。

ご迷惑をおかけいたしまして大変申し訳ございませんが、今しばらくお待ちくださいますようお願い申し上げます。

なお、現時点における本問題の対処策といたしまして、以下のいずれかを実施くださいますようお願いいたします。

  1. PowerShell を管理者として起動し、以下コマンドを実行のうえKB3176934 をアンインストールしてください。
  2. WSUS にて更新プログラムを適用されている環境である場合は、自動更新を許可しないでください。グループ ポリシーまたはレジストリの設定を使用して自動更新を構成する場合は以下公開情報をご参考ください。

グループ ポリシーまたはレジストリの設定を使用して自動更新を構成する方法

https://support.microsoft.com/ja-jp/kb/328010

  • 本既知の問題に関する英語ブログ:

PowerShell DSC and implicit remoting broken in KB3176934

https://blogs.msdn.microsoft.com/powershell/2016/08/23/powershell-dsc-broken-in-kb3176932/

MSDN Blogs: Pozvánka na Xamarin Dev Days v Praze

$
0
0

V sobotu, 17. září 2016, se v Praze konají Xamarin Dev Days.62667519903450fd340383e1e03b7001 Jedná se o akci, která je plná intenzivních přednášek a hands-on ukázek zaměřených jak na samotný Xamarin, tak i na Xamarin Forms, dále pak na propojení s různými službami z portfolia Microsoft Azure nebo třeba na testování aplikací v Xamarin Test Cloudu. Účastníci by si na akci měli přinést i vlastní počítač, na kterém budou následně v hands-on části vyvíjet.

Akce se koná v sídle Microsoftu v Praze (Vyskočilova 1561/4a). Více informací o akci včetně registrace a programu naleznete na jejím webu.


MSDN Blogs: Windows 10 Hardware Lab Kit (HLK) の日本語サポート

$
0
0

HLK サポート チームでは、下記のような HLK 使用時に発生する問題や HLK に関連する問題に関する技術サポートを提供します。

 

·         HLK の環境構築方法や操作方法について

·         HLK の各テストの実行方法について

·         HLK の各テスト実行時に発生した問題について

·         HLK が出力する各ログ ファイルの参照方法や内容について

·         HLK の既知の問題 (Errata) について


ただし、以下の HLK に関するお問い合わせは HLK サポート チームではない別の窓口より案内しています。
 

·         Preview 版の HLK に関する質問: Windows ハードウェア デベロッパー センターのフィードバックサイトより、評価版に関するフィードバックとしてご報告ください。

·         Windows ハードウェア互換性プログラムで利用できないバージョンの HLK: 新しい HLK がリリースされた後、以前のバージョンの HLK より取得したテスト結果の受付は一定期間をもって終了します。終了の時期については、 Windows ハードウェア認定ブログ (英語)などでアナウンスされます。お使いの HLK Windows ハードウェア互換性プログラムで利用可能かどうか、事前にご確認ください。
なお、Windows ハードウェア互換性プログラムで利用可能な HLKであっても、一部のバージョンでは例外的に HLK サポート チームでサポートを承れないことがあります。

 

また、HLK に直接関連していない内容が含まれている以下の内容のお問い合わせも、HLK サポート チームではない別の窓口からの案内となります。 認定プログラムに関するヘルプとサポートの連絡先を参照のうえ、適切なお問い合わせ先までご相談ください。

·         Windows 互換性プログラムのポリシーや認定要件に関する質問

·         サブミッションの申請方法

·         Windows デベロッパー センターのダッシュボード サイトの利用方法

 

HLK サポート チームが提供する技術サポートは、通常のマイクロソフト製品サポート サービスとしての対応となり、有償でのご提供となります。日本のパートナー様は、日本語でのサポートサービスをご利用いただけます。ご利用可能なサポート サービスの詳細については、 マイクロソフト有償サポートサービスのページをご覧ください。

·         プレミアサポートをご契約いただいているパートナー様には、マイクロソフトのテクニカル アカウント マネージャー (TAM) の支援を受けながら、サポートインシデントをオープンしていただくことができます。

·         プレミアサポート未契約のパートナー様には、 プロフェッショナル サポートをご利用いただくことができます。

·         パーソナルサポートはご利用いただけませんので、ご注意ください。

 

各サポート サービスに関してご不明な点がありましたら、下記の窓口までお問い合わせください。

  ————————————————————————————-

   マイクロソフト サポート契約センター

   TEL: 0120-17-0196 / FAX: 0120-74-0196

   営業時間 : 9:00 – 17:30 (土日祝日、 弊社指定休業日を除く)

  ————————————————————————————-

 

以下に、HLK に関して日本のパートナー様からよく寄せられる質問と回答 (FAQ) を紹介しています。実際にお問い合わせいただく前にご確認ください。

 

また、HCK 及び WLK に関する日本語サポートに関するご案内は、以下のサイトよりご確認ください。

 

Windows ハードウェア認定キット (HCK) および Windows Logo Kit (WLK) の日本語サポート

https://msdn.microsoft.com/ja-jp/windows/hardware/gg546052

 

お問い合わせのプロセス/手順に関する FAQ:

Q: HLK のサポートを受ける場合、具体的にどのような手順で問い合わせればよいですか。電子メールや Web フォームでの問い合わせになりますか?

ご契約いただいているサポート サービスの形態によって異なりますので、まず、どのようなサポート契約をご締結済みであるかをご確認ください。ご締結いただいていない場合には、新規にご契約いただく形になります。有償サポートおよびサポートインシデントのご利用方法や、サポート オプションの詳細につきましては、 マイクロソフト有償サポートサービスのページをご参照ください。

締結済みかどうかご不明な場合、またサポート サービスに関してご不明な点がありましたら、「マイクロソフト サポート契約センター」まで電話または FAX にてご確認ください。

 

Q: HLK のサポートは誰でも受けられますか? マイクロソフトとはサポート契約を結んでいません。

新規にマイクロソフト 有償サポート サービスのサポート契約をご締結いただく必要があります。また、ご契約いただいているサポートサービスが、プレミアサポートである場合、弊社のテクニカル アカウント マネージャー (TAM) を介してお問い合わせください。 サポート サービスの詳細は、前述のサポート サービスのページをご参照いただくか、「マイクロソフトサポート 契約センター」 までお問い合わせください。

 

Q: 複数のサポート サービスを契約していますが、どのサポート サービスを利用すればいいのでしょうか?

プレミア サポートをご契約いただいている場合、プレミア サポートのご利用を推奨いたします。

 

Q: MSDN インシデントで HLK サポートへ問い合わせはできるのでしょうか?

いいえ。MSDN インシデントは、MSDN Subscription で提供している製品を対象にしています。しかしながら、Windows ハードウェア認定プログラムへの申請が可能なバージョンの HLK MSDN Subscription では提供していないため、MSDN インシデントを利用して HLK サポートへお問い合わせいただくことはできません。

 

Q: 数件の質問をまとめて問い合わせても構いませんか?

ご契約いただいているサポート サービスの形態によって異なります。

たとえば、 プロフェッショナル サポートでは、「それ以上分けることのできない質問 1 件の単位」をサポート インシデントと定義し、1 つの問題につき 1 インシデントで対応させていただきます。そのため、お問い合わせ内容が多岐にわたる場合には、問題の切り分けを行なっていただき、複数のお問い合わせに分けていただく必要があります。

 

Q: 問い合わせの際には、どういった情報が必要ですか?

テスト結果に関するお問い合わせの場合、Windows ハードウェア互換性プログラムに申請するパッケージファイル (HLKX ファイル) をご用意ください。

また、事前に HLK に適用可能な最新の Update Filters及び Compatibility Program Playlistを適用いただくことを推奨します。

 

Q: 問題の説明のための参考情報ファイル (ログ ファイル、スクリーン ショット、など) はどのように送ればよいですか?

追加情報の送付方法につきましては、担当エンジニアよりご連絡します。

 

Q: 問い合わせた内容や進捗状況はどのように確認できますか?

担当エンジニアより、定期的に進捗状況をご報告いたします。

 

Q: 問い合わせに対する回答には大体どのくらいの日数がかかりますか?

回答までの日数はご質問の内容によって異なりますが、問い合わせを受け付けた後、担当エンジニアより問題のヒアリングのために即日中にご連絡させていただきます。(なお、営業時間が 17:30 までとなっているため、場合によっては翌日のご連絡となることもあります。あらかじめご了承ください。)

その後、最終的な回答までは定期的な進捗報告にて対応さいたします。

 

Q: 他社から委託を受けてテストを行なっています。委託元の会社に直接回答をしてもらえますか?

お問い合わせのご契約者様以外へ回答することはできません。また、委託元の会社など第三者を含めた形でのお問い合わせはご遠慮ください。HLK サポート チームからの回答やご報告は、ご利用の有償サポート サービスのご契約者様のみを対象とさせていただきます。

 

サポート費用に関する FAQ:

Q: 有償サポートの費用に関して、どこに問い合わせればよいですか?

費用は、ご契約いただいているサポート サービスの形態によって異なります。 サポートサービスのページをご参照いただくか、「マイクロソフトサポート契約センター」 まで電話または FAX にてご確認ください。

 

Q: 問題の原因が OS 側や HLK 側にあった場合も費用は発生しますか?

OS HLK 側の不具合が原因であれば費用 (インシデントの消費) は発生しません。詳しくはインシデント ガイドラインをご確認ください。なお、不具合とみなされる目安といたしましては、Errata ID をご報告させていただいた問題であるかどうか、ということになります。

 

Q: 有償サポートに問い合わせた場合、費用はどういった単位でどのくらい発生しますか?

ご契約いただいているサポート サービスの形態によって異なります。1 つのお問い合わせに対して、インシデント単位で発生するものや、時間単位で発生するものなどがあります。詳しくは前述のサポートサービスのページをご参照いただくか、「マイクロソフト サポート契約センター」 までお問い合わせください。

 

Q: 費用はいつ、どのように請求されますか?

ご契約いただいているサポート サービスの形態によって異なります。契約のご締結時にあらかじめお支払いただいている場合や、案件終了時にご請求させていただく場合などがあります。詳しくは前述のサポートサービスのページをご参照いただくか、「マイクロソフト サポート契約センター」 までお問い合わせください。

 

Errata ID に関する FAQ:

Q: Errata ID とは何ですか?

Fail や未実施となってしまうテストの問題を解決するための ID のことです。

お問い合わせいただいた問題の原因がマイクロソフトの OS 標準のモジュールや HLK に起因する場合、HLK サポート チームからその問題を解決するための Errata ID を発行させていただく場合があります。

 

Q: Errata ID はどんな問題についても発行されますか?

いいえ。問題の原因が、マイクロソフトの OS 標準のモジュールや HLK に起因する場合に限られます。対象のハードウェアやドライバー側、あるいはテスト環境の構築方法や HLK の操作方法などに起因する問題の場合には、Errata ID は発行されません。

 

Q: 以前、ある製品で発生した問題のために発行された Errata ID があります。新たに別の製品についてテストを実行中に同じ問題が発生しましたが、以前の Errata ID をそのまま使用して申請しても問題ありませんか?

いいえ。Errata ID はあくまでも暫定的なものになります。たとえば、Errata ID の発行後に公開された最新バージョンの HLK Updated Filters を適用することで問題が解決できるようになった場合には、Errata ID が無効になる場合があります。また、一見同じ問題であっても、対象の製品の仕様やお使いの HLK のバージョン、OS の違いなどによっては、原因が異なる問題である可能性があります。以前の Errata ID がそのまま使用可能であるかについては、事前に HLK サポートまでご確認ください。

 

Q: 以前の Errata ID が有効かどうか問い合わせた場合、費用が発生しますか?

いいえ。費用 (インシデントの消費) は発生しません。

 

Q: HLK サポートに Errata ID の発行を依頼することはできますか?

Errata ID の発行のみを前提とした依頼は承っておりません。Errata ID は、担当サポートチームが調査した結果、Errata ID が必要であると判断した問題のみに対して、発行いたします。そのため、担当サポートチームが調査を行わず Errata ID を発行することはできません。

 

Q: Errata ID の発行にどれぐらいの期間がかかりますか?

Errata ID を発行する前に実施する担当サポートチームの調査は、平均 1015 営業日程度必要となります。担当サポートチームが Errata ID の発行が必要であると判断した後は、5 営業日程度必要となります。ただし、発生している問題が複雑な場合やお問い合わせが集中している場合は、平均的な期間より多くの期間が必要となることがあります。

 

Q: ハードウェアの認定要件を満たしていますが、HLK のテストで Fail が発生します。Errata ID は発行してもらえますか?

Errata ID を発行することを確約することはできません。HLK ではハードウェアの認定要件のテストのみならず、一般的なシナリオに基づいたテストも行います。開発されたデバイスやドライバーの動作によっては、このようなテストで Fail が発生することがあります。このようなケースでの Fail でもデバイスやドライバーの対応が必要な場合があります。

 

トラブルシューティングに関する FAQ:

Q: Update Filters に含まれている一部の Filter だけを適用することはできますか?

いいえ。一部の Filter だけを適用することはできません。すべての Filter を適用する必要があります。

 

Q: どのタイミングで Update Filters を適用すればいいですか?

Update Filters は日々更新されています。テスト実施の直前に Update Filters を確認し、最新のものを適用してください。

 

Q: HLK のテスト環境に日本語 OS を使用することはできますか?

いいえ。テスト対象となるマシンは英語バージョンの OS がインストールされている必要がございます。マシン要件の詳細については Windows HLK Prerequisitesをご参照ください。

 

Q: 一部のテストのみ実行されません。何かが足りないのでしょうか?

テストごとに実行要件が異なりますので一概には申し上げられません。実行要件を満たさない場合、テストは実施されませんので、まず HLK のヘルプ ファイルでテストごとの実行要件をご確認ください。

 

Q: テストが実行されているのですが、ログが記録されていません。何か問題があるのでしょうか?

テスト実行中に、ブルースクリーンが発生している可能性があります。ブルースクリーンが発生していないかご確認ください。

 

 

Q: テスト実行中に、ブルースクリーンが発生していました。どうすればいいでしょうか?

ブルースクリーンが発生すると Windows はダンプ ファイルを生成します。このダンプファイルを Windows 用デバッグツールを使用して解析をしてください。解析方法が不明な場合は、 プレミアサポートより HLK サポートにお問い合わせください。

 

Q: テストで発生した Fail は、どうやって詳細を確認すればいいのでしょうか?

HLK では、HLK Studio を起動し、画面右上の [Connect] から Windows ハードウェア互換性プログラムに申請するパッケージファイル (HLKX ファイル) を読み込むことができます。

 

Q: テストで Fail が発生した場合、すぐに HLK サポートに問い合わせたほうがいいのでしょうか?

HLK サポートにお問い合わせいただく前に、まず最新の Update Filters 及び Hardware Compatibility Playlist が適用されているかご確認ください。

 

Q: : Windows ハードウェア互換性プログラムに申請するパッケージ ファイル (HLKX ファイル) に記録されているエラー情報の Error Exception 16 進数の値は何でしょうか?

この情報はテストによって異なりますが、多くの場合、NT Status Code もしくは Win32 Error Code になります。詳細は WDK のヘッダー ファイルでご確認ください。

 

Q: HLK Studio [Use a certificate file] オプションから cer ファイルを使用して署名しようとしても、“Unable to use the selected certificate to sign the package” と表示されて署名できません。

HLK Studio がインストールされている環境に、署名に必要な秘密鍵を持つ証明書が見つからない場合、上記のようなエラーが発生する場合があります。証明書ストアに、秘密鍵の格納された pfx ファイルがインポートされているかどうかご確認ください。

 

その他の FAQ:

Q: HLK ではなく、認定プログラムや申請方法について分からないことがあります。

HLK サポート チームでは、HLK 使用時に発生する問題など HLK に関連した問題に対してのみ技術サポートを提供しております。

HLK 以外の、互換性プログラム関連および申請方法のご質問は、 ハードウェア開発者向けのサポートとコミュニティのページや 認定プログラムに関するヘルプとサポートの連絡先をご参照のうえ、適切なお問い合わせ先までご相談ください。

 

Q: HLK 以外の問題についても受けてもらえますか?

HLK サポート チームでは、HLK 使用時に発生する問題など HLK に関連した問題に対してのみサポートを提供しているので、お受けすることができません。しかしながら、サポート部門として、OS に関するお問い合わせやハードウェア/ドライバー開発に関するお問い合わせなどは承っておりますので、別途サポート部門にお問い合わせください。

 

Q: HLK のテストで発生した問題がハードウェアやドライバー側にあった場合、問題の原因の調査や解析なども行ってもらえますか?

ハードウェア/ドライバー側の問題の原因の調査や解析については、HLK サポート チームでは承ることができません。もし、開発中のドライバーの問題である場合は、有償サポート サービスをご利用いただき、DDK もしくは WDK のご質問としてお問い合わせください。なお、ハードウェアの問題や切り分け作業については、プレミアサポートをご利用いただき、弊社のテクニカル アカウント マネージャー (TAM) を介してお問い合わせください。

 

Q: テストを実行したところ Fail になりました。原因はよくわからないのですが、Pass させる方法はありませんか?

最新の Updated Filters を適用しても解決しない問題については、調査の上、正しく解決する必要があります。テスト結果を強制的に Pass にするような方法はありません。なお、ハードウェア互換性プログラムへの申請では、Compatibility Program Playlist より指定されているテストのみ Pass する必要がございます。ハードウェアにて対応を想定していない動作に関するテストで Fail している場合は、最新の Playlist を適用いただき、そのテストが互換性プログラムへの申請において必要かご確認ください。

 

Q: HLK の環境構築の質問はできますか?

ご質問の内容によっては、回答できないことがあります。テストによっては、事前の環境構築で HLK とは関連がない環境構築が必要となる場合があります。このような HLK のドキュメントでご案内していない環境構築に関するご質問については、回答できないことがあります。

 

Q: サポート対象の HLK のバージョンはどれでしょうか?

サブミッションに使用可能なバージョンに対してのみサポートを行っています。たとえば、Preview 版の HLK や使用期限を過ぎた前バージョンの HLK はサポートの対象外となります。

 

Q: 切り分けをしましたが、ちゃんと判断できているか自信がありません。

HLK サポートチームが、サポートの提供が可能かどうかを判断するため、切り分けを行った結果を踏まえてお問い合わせください。 HLK サポートチームが適切に切り分けられていると判断した場合は、お問い合わせを受け付けます。

 

Q: サポートを受け付けてもらえなかった場合、サポートを受け付けてもらえるためのアドバイスはありますか?

サポートを提供できない理由のご説明はしますが、アドバイスは行っていません。もし、アドバイスが必要な場合は、Premier サポートをご利用ください。

MSDN Blogs: Logic Apps SQL Connector – Working with Stored Procedures

$
0
0

Handling Input Data

Let’s start with creating an Employees table with following schema:

Create Employee table

MSDN Blogs: ダンプファイルに保存された ETW トレースログを表示する

$
0
0

ご自身が開発されているドライバについて、BSOD 発生時点のダンプファイルの情報からでは根本原因がわからず、BSOD 直前から発生までのドライバ内部の状態を知りたいと思ったことはありますか?

 

皆さん、こんにちは。Windows Driver Kit サポートチームの津田です。今回は、そんな皆様に、ETW トレースログを BSOD 発生時点のダンプファイルから参照する方法をご案内します。ETW についてご存じない方は、まずは、以前の「Event Tracing for Windows (ETW)<https://blogs.msdn.microsoft.com/jpwdkblog/2011/12/27/event-tracing-for-windows-etw/> のエントリをご参照ください。

 

BSOD が発生するまでのトレースログがダンプファイルで参照できますと、以下の 4 点の事前準備は必要ですが、BSOD 発生時のメモリやレジスタの情報から逆アセンブリを追いかけるだけでは遡れなかった情報が取得できます。

 

  (a) BSOD 発生時のダンプファイルで、根本原因特定のために知りたい変数や構造体を特定する。

  (b) それがわかるよう、ETW トレースログをご自身のドライバのソースコードに埋め込む。

  (c) そのドライバを、現象が再現する環境にインストールする。

  (d) logman.exe でトレースログ採取を開始した後、現象を再現する。

 

これにより、根本原因が判明する可能性が高まります。しかも、ライブデバッグのように WinDbg をカーネルデバッグ接続してタイミングが変わったり、ソースコードのどこが原因なのか必ずしも特定できていない状況でステップ実行をするというような時間がかかったりするというデメリットを回避できます。

 

本ブログ エントリでは、以下の前提で進めます。

 

  – (a),(b) は省略します。

  – (c) として上述のブログ エントリで使用した tracedrv ドライバ サンプルを使用します。

  – (d) を実施して、NotMyFault というツールで強制的に BSOD を発生させ、ダンプファイルを採取します。

  – そのダンプファイルを WinDbg でオープンし、!wmitrace デバッガエクステンションを使用して、BSOD 発生直前までの ETW トレースログを表示します。

 

具体的には、以下の手順で進めます。

 

  1. tracedrv サンプルの入手

  2. サンプルのビルド

  3. テスト環境に必要なファイルをコピー

  4. 完全メモリダンプの設定

  5. logman.exe でトレースログ採取を開始

  6. tracectl.exe を実行してトレースメッセージを生成

  7. NotMyFault を使用して BSOD を発生

  8. ダンプファイルを WinDbg でオープン

  9. !wmitrace を使用して ETW トレースログを表示

 

今回は、例として Windows 10 (1607) x86 で行います。

 

1. tracedrv サンプルの入手

 

Tracedrv サンプルは、以下のサイトの右上にある [Clone or download] から [Download ZIP] Windows-driver-samples-master.zipをダウンロードすると、Windows-driver-samples-mastergeneraltracingtracedriver のフォルダにあります。

 

  <https://github.com/Microsoft/Windows-driver-samples>

 

 

2. サンプルのビルド

 

このフォルダの tracedrv.sln を、Visual Studio 2015 で開きます。

 

[ソリューション ‘tracedrv’]を右クリックして [構成マネージャー] をクリックします。

 

clip_image002

 

[アクティブ ソリューション構成] [Debug][アクティブ ソリューションプラットフォーム] [Win32] とします。

 

clip_image004

 

続いて、[ソリューション エクスプローラー] 内で [Tracectl]のフォルダを展開し、[Tracectl] のプロジェクトを右クリックして [プロパティ] をクリックします。

 

clip_image006

 

[tracectl プロパティページ]の左側のペインで [構成プロパティ] [C/C++][コード生成] を選択し、右側のペインで [ランタイム ライブラリ] [マルチスレッド デバッグ (/MTd)]に変更し [OK] をクリックします。テスト対象の環境にランタイムライブラリ DLL を入れていない場合のために、静的リンクのライブラリでビルドしておくための手順です。

 

clip_image008

 

[ソリューション‘tracedrv’]を右クリックして [ソリューションのリビルド]をクリックします。tracedrivertracectlDebug フォルダに tracectl.exetracedrivertracedrvDebug フォルダに tracedrv.sys tracedrv.pdb が確認できます。

 

tracedrv.pdb は後述の手順 9 でメモリダンプに含まれる ETW トレースログを人間が読めるメッセージ形式にデコードするために必要となります。

 

 

3. テスト環境に必要なファイルをコピー

 

上述の tracectl.exe tracedrv.sys を、テスト環境の Windows 10 (1607) x86 の同一フォルダ (例: C:tracedrv) にコピーします。

 

また、併せて tracedrivertracedrv フォルダにある tracedrv.ctl ファイルもコピーします。これは、「d58c126f-b309-11d1-969e-0000f875a5bc    CtlGuid」という内容を含むテキストファイルであり、後程の手順 5. logman.exe によるトレースログ採取を開始する際に使います。

 

続いて、後程の手順 7. で、 NotMyFault ツールを使って BSOD を発生させるので、以下の URL から NotMyFault.zip をテスト環境にダウンロードします。

 

  <https://live.sysinternals.com/Files/NotMyFault.zip>

 

ダウンロードが完了したら、zip ファイルを展開してください。 今回は Windows 10 x86 環境ですので、展開したフォルダの直下にある notmyfault.exe を使用します。

 

 

4. 完全メモリダンプの設定

 

以下のブログエントリに記載の手順で完全メモリダンプを取得できるよう設定します。

 

  完全メモリダンプ採取の設定方法

  <https://blogs.msdn.microsoft.com/jpwdkblog/2016/06/29/%e5%ae%8c%e5%85%a8%e3%83%a1%e3%83%a2%e3%83%aa%e3%83%80%e3%83%b3%e3%83%97%e6%8e%a1%e5%8f%96%e3%81%ae%e8%a8%ad%e5%ae%9a%e6%96%b9%e6%b3%95/>

 

 

5. logman.exe でトレースログ採取を開始

 

管理者権限のコマンドプロンプトを起動します。tracedrv.ctl をメモ帳で開くと、「d58c126f-b309-11d1-969e-0000f875a5bc」の GUID が確認できます。

これを用いて、保存したフォルダ (例: C:tracedrv) で、下記のコマンドを実行します。

 

echo {d58c126f-b309-11d1-969e-0000f875a5bc} 0x1 > TestTrace.ctl

 

logman -ets start TestTrace -pf TestTrace.ctl

 

これらのコマンドについては、「Event Tracing for Windows (ETW)」のブログエントリの「■ logman.exe によるログの採取方法」をご参照ください。

 

 

6. tracectl.exe を実行してトレースメッセージを生成

 

コマンドプロンプト上で tracectl.exe をオプションなしで実行します。

すると、tracedrv.sys がロードされます。コマンドプロンプト上で Q または q 以外の文字を入力するたびに、 tracectl.exe I/O Control tracedrv.sys に送り、 tracedrv.sys はトレースメッセージを生成します。

今回は “a, b, c” と順に入力します。(次の手順で BSOD を発生させるので、Q または q を入力しません。)

 

 

7. NotMyFault を使用して BSOD を発生

 

手順 3 でダウンロードした notmyfault.exe を実行します。

[Crash]タブにある Options のオプションであれば何でもいいのですが、今回は、デフォルトの [High IRQL fault (Kernel-mode)] のまま、右下の [Crash] ボタンを押します。

BSOD が発生し、「~ % complete」の数字が 100 % になったら、完全メモリダンプの採取が完了したため、OS が再起動します。

 

clip_image010

 

 

8. ダンプファイルを WinDbg でオープン

 

OS が起動したら、%SystemRoot%MEMORY.DMP に完全メモリダンプが保存されていますので、これを WinDbg.exe で開きます。

 

WinDbg.exe の入手方法についてご存じない方は、以下のブログエントリをご参照ください。

 

  デバッガ (WinDbg) をインストールする

  <https://blogs.msdn.microsoft.com/jpwdkblog/2016/03/07/%e3%83%87%e3%83%90%e3%83%83%e3%82%ac-windbg-%e3%82%92%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%81%99%e3%82%8b/>

 

WinDbg.exe を開いたら [File] > [Open Crash Dump]で該当メモリダンプ (MEMORY.DMP) を開きます。

 

[Command] ウィンドウが開き、以下のような内容が表示された後、一番下の「kd>」 の右側の枠にコマンドが入力可能となります。

 

clip_image012

 

 

9. !wmitrace を使用して ETW トレースログを表示

 

ETW トレースログを表示するためには、トレースログをデコードするために、シンボルファイルが必要になります。

そこで、WinDbg.exe [File] > [Symbol File Path] をクリックし、開いた [Symbol Search Path] というウィンドウの [Symbol Path:]に、手順 2 で生成した tracedrv.pdb があるフォルダを入力します。

そして、下部の [Reload]にチェックを入れて、右側の [OK] をクリックします。

 

[Command]ウィンドウで以下を実行します。

 

!wmitrace.logdump TestTrace

 

TestTrace は手順 5 logman.exe を実行する際に「logman -ets start TestTrace -pf TestTrace.ctl」と入力した、トレースセッション名です。

 

実行結果は以下の通りです。

 

[0]1038.103C::08/20/2016-15:36:42.169 [tracedrv]IOCTL = 1

[0]1038.103C::08/20/2016-15:36:42.169 [tracedrv]Hello, 1 Hi

[0]1038.103C::08/20/2016-15:36:42.169 [tracedrv]Hello, 2 Hi

[0]1038.103C::08/20/2016-15:36:42.169 [tracedrv]Hello, 3 Hi

[0]1038.103C::08/20/2016-15:36:42.169 [tracedrv]Function Return=0x8000000f(STATUS_DEVICE_POWERED_OFF)

[0]1038.103C::08/20/2016-15:36:45.706 [tracedrv]IOCTL = 2

[0]1038.103C::08/20/2016-15:36:45.706 [tracedrv]Hello, 1 Hi

[0]1038.103C::08/20/2016-15:36:45.706 [tracedrv]Hello, 2 Hi

[0]1038.103C::08/20/2016-15:36:45.706 [tracedrv]Hello, 3 Hi

[0]1038.103C::08/20/2016-15:36:45.706 [tracedrv]Function Return=0x8000000f(STATUS_DEVICE_POWERED_OFF)

[0]1038.103C::08/20/2016-15:36:47.098 [tracedrv]IOCTL = 3

[0]1038.103C::08/20/2016-15:36:47.098 [tracedrv]Hello, 1 Hi

[0]1038.103C::08/20/2016-15:36:47.098 [tracedrv]Hello, 2 Hi

[0]1038.103C::08/20/2016-15:36:47.098 [tracedrv]Hello, 3 Hi

[0]1038.103C::08/20/2016-15:36:47.098 [tracedrv]Function Return=0x8000000f(STATUS_DEVICE_POWERED_OFF)

 

Event Tracing for Windows (ETW)」のブログエントリの「(8) tracefmt.exe を使い、 tracedrv.etl のトレースメッセージを表示」の結果と同じであることが確認できます。

 

 

以上の方法で、ダンプファイルに ETW トレースログを保存し、それをデバッガで表示することができました。読者の皆様のデバッグに少しでもお役に立てましたら幸いです。

 

 

■参考文献

 

  !wmitrace.logdump

  <https://msdn.microsoft.com/ja-jp/library/windows/hardware/ff566159(v=vs.85).aspx>

 

MSDN Blogs: 8/29 – Errata added for [MS-TDS]: Tabular Data Stream Protocol

MSDN Blogs: Power BI at SQL Saturday Portland Oct 22

$
0
0
This year SQL Saturday has dedicated an entire track to Power BI.  They are still deciding which sessions they will be hosting, but the initial submissions are looking great!

In addition to the Power BI sessions CSG will also be offering a Dashboard in an hour Session!

If you are are not familiar w/ this event, SQLSaturday is a free training event for SQL Server professionals and those wanting to learn about SQL Server. This event will be held on Oct 22 2016 at Washington State University Vancouver, 14204 NE Salmon Creek Ave , Vancouver, Washington, 98686, United States

For more information Check out: http://www.sqlsaturday.com/572/eventhome.aspx

image

 

Session Title 
 TitleSpeaker
1Analyzing your online presence using Power Bl


Asgeir Gunnarsson

2Analyzing SQL Server Data usin PowerPivot in MS Excel


Wylie Blanchard

3Azure Machine Learning: From Design to Integration Peter Myers
4Code Like a Pirate Intro to R and Data Science Tools in MS Jamey Johnston
5Mobile, Paginated, KPls, and Power Bl, Oh My! SSRS 2016 Reporting Steve Wake
6Power Bl for the Developer Peter Myers
7Reports on the Run: Mobile Reporting with SQL Server 2016 Peter Myers
8SQL Server R Services in SQL 2016 Chris Hyde
9

Calling REST APIs, working with JSON and integrating with your Web Development using Power BI

Charles Sterling

 

Calling REST APIs, working with JSON and integrating with your Web Development using Power BI

Charles Sterling shows how to use Power BI in your development efforts specifically how to call REST APIs with Power BI without writing any code.  Parsing, modeling and transforming the resulting JSON to make creating rich interactive reports a snap and integrating this into your  development efforts by embedding the Power BI data visualizations into your web applications.

http://aka.ms/chassbio

Viewing all 3015 articles
Browse latest View live